2

I had sublime text 2 command line tools working. When I downloaded Sublime Text 3, I could not get the command line tools to work. I've tried every answer here: Open Sublime Text from Terminal in macOS. When I type:

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

I get back:

ln: /usr/local/bin/subl: File exists

but no matter what I do I still get back -bash: subl: command not found

Community
  • 1
  • 1
Philip7899
  • 4,599
  • 4
  • 55
  • 114

2 Answers2

6

Remove the existing link first. It must be a broken link.

List the contents of the directory and you'll see that the link is broken:

$ ls -Al /usr/local/bin/

Output from the above command will show that the existing link is pointing to a non existing file. So delete the broken link:

$ rm /usr/local/bin/subl

You might need to use sudo for the above command.

Now you can create the symlink:

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
Gerard Roche
  • 6,162
  • 4
  • 43
  • 69
0

I had the same issue and nothing seemed to work. Also, if you have Sublime 2, remember to use:

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

I was not getting it right at first because I forgot the version!

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Thais
  • 1
  • 3