The Sublime Text documentation “OS X Command Line” references the command line tool,
subl to work with files on the command line.
This allows you to open the entire current directory in sublime like this:
$ subl .
This allows you to open a specific file like this:
$ subl <file_name>
$ sign means this is run in your command line application.
subl is not available by default
$ subl is not immediately accessible when you download Sublime. Without symlink-ing the command, you will have to type the full path to the original
This is how you would use the full path to open a file.
$ /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl <file_name>
So lets create a symlink
The official docs ask you to target your symlink to
~bin/subl but it may be nicer to keep symlinks contained to existing “load paths” like
What are your “load paths”? Find your current load paths by running this command:
$ echo $PATH
You will see all load paths including these default OS X paths:
How to create
subl shortcut for Sublime Text
Run this command in your terminal:
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
ln means link,
-s means we want a symbolic link
We will create a symlink at
usr/local/bin/subl that will point to the original Sublime command. Deleting this link will have no effect on the original file.