Sublime Text 3: OS X Command Line

Published on 20 February 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 Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

where

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”


Originally published at victorleungtw.com on February 18, 2015.