Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to get the Sublime Text 2 command "subl" to work in Terminal but I am having trouble.

I keep getting a "command not found" after it already told me that the file existed. What am I doing wrong?

Here is my code:

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

ln: /usr/bin/subl: File exists 

$ subl 

-bash: subl: command not found

Thanks!

share|improve this question
    
Please post the results of ls -l /usr/bin/subl and file /usr/bin/subl. –  terdon Mar 14 '13 at 18:24
    
Are you linking to /usr/bin or /usr/local/bin/? –  terdon Mar 14 '13 at 18:34

1 Answer 1

Make sure the file is executable

Check the output of ls -l ~/Applications/Sublime\ Text\ 2/sublime_text and make sure the file is executable.

You can just run chmod +x ~/Applications/Sublime\ Text\ 2/sublime_text to ensure it is.

Check your path

Run echo $PATH and make sure that /usr/local/bin is in there. It's probably not, so add it

Start over

Alternatively, you can just start over. rm /usr/local/bin/subl to remove it. If this fails due to insufficient permissions, sudo rm /usr/bin/subl instead. You need to enter your password.

Make sure you're actually executing the correct command

The instructions say to run the following command:

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

Note that the first argument (the link target) is different from yours. The file you're linking to probably doesn't exist.

share|improve this answer
    
It worked! I basically had to start over. Thank you for your suggestions –  J Twitts Mar 14 '13 at 19:16
    
@JTwitts If an answer answers your question, please accept it by clicking the check mark next to it. This will indicate to others that your question is answered. –  Daniel Beck Mar 14 '13 at 19:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.