Sublime Text 3 from command line in OS X
Sublime Text 3 comes with a cli tool called subl
to work with files on the command line. But
it is not available from terminal by default.
In the documentation it is said that this tool
is located in /Applications/Sublime Text.app/Contents/SharedSupport/bin/
folder. And to make it available
you should create a symlink in /bin/subl
folder.
In OS X the load path be default is /usr/local/bin
. So to run sublime from terminal we should place a symlink
for it in this folder:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Now I can easily open Sublime Text from the command line:
// opens current directory
subl .
// opens Docs directory
subl ~/Docs