Sublime Text 2 on the OS X Command Line

To use Sublime Text 2 as command line editor, you need to create a symlink:

If installed via Homebrew Cask:

ln -s "/opt/homebrew-cask/Caskroom/sublime-text/2.0.1/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

or, if installed manually:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

And if you want to use it as your default editor e.g. for git status messages, set your EDITOR environment variable like this:

vi .bashrc

export EDITOR='subl -w'
Matthias Marschall Almost 12 years ago