Sublime Text 3: Using the OS X Command Line

February 20, 2015

The Problem

2015 02 20

Sublime Text 3 includes a command line tool, subl. Unfortunately, this tool doesn't work right out of the box after you've installed the editor on OS X Yosemite.

My Solution

After installing Sublime Text 3, create a symbolic link using the following command:

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


  • /Applications/Sublime\ is the location where the application is stored in your Applications directory.
  • /usr/local/bin is the chosen path where you want the symbolic link to reside.

To set Sublime Text as the default editor for various commands that prompt for input, configure your EDITOR environment variable as follows:

export EDITOR='subl -w'

The -w flag ensures that the subl command will not exit until the file is closed.

Additionally, you can set Sublime Text as your default Git editor with this command:

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

Profile picture

Victor Leung, who blog about business, technology and personal development. Happy to connect on LinkedIn