Sublime Text 3: OS X Command Line

February 20, 2015

The problem

Sublime Text 3 includes a command line tool, subl. However, it does not work out of the box after you install the editor in OS X Yosemite.

My solution

After the installation, create a symbolic link to Sublime Text using this command:

    ln -s /Applications/Sublime /usr/local/bin/subl


- ‘/Applications/Sublime’ is the location that the application is stored in your Applications directory.
- ‘/usr/local/bin’ is the chosen path you want the symbolic link to be located.

To use Sublime Text as the editor for many commands that prompt for input, set your EDITOR environment variable:

    export EDITOR='subl -w'

where the flag -w will cause the subl command not to exit until the file is closed.

You can also set your default editor in Git with this command:

    git config --global core.editor "subl -n -w"

Profile picture

Experience in software development, application architecture, and deploying cloud solutions for enterprise customers. Strong hands-on skills with a Master's degree in Computer Science and business acumen with a master of business administration (MBA) in Finance. Certified in Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, Kubernetes (CKA, CKAD, CKS, KCNA) and Scrum (PSM, PSPO) with experience in building banking products from scratch. Connect on Linkedin

© 2022, @victorleungtw