Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 - OS X Command Line

Original Sublime 2 instruction for enabling editor to launch from command line:

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

do not work in Mountain Lion.

like image 497
Pavel Binar Avatar asked Dec 01 '12 01:12

Pavel Binar


2 Answers

Create the ~/bin directory if it doesn't already exist:

mkdir ~/bin

Then run the ln again. Make sure that directory is added to your $PATH by adding this to the ~/.bashrc file, creating it if it doesn't exist:

export PATH="$PATH:~/bin"

If you don't use bash, use your manual to figure out how to add a directory to your $PATH variable.

This is actually what the instructions say:

The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run: [snip]

This implies you need to create the ~/bin directory if it doesn't exist, and add it to your $PATH if it is not there already. The above instructions do exactly that.

If you don't like that ugly bin folder in your pretty home folder, you can use chflags to make it disappear from the Finder:

chflags hidden ~/bin
like image 99
zneak Avatar answered Sep 30 '22 13:09

zneak


Change target directory to system folder /usr/bin and use sudo for admin rights.

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
like image 37
Pavel Binar Avatar answered Sep 30 '22 12:09

Pavel Binar