Sublime Text 3: OS X Command Line

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

  • ‘/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl’ 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"

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

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.