问题
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
回答1:
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
回答2:
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!
来源:https://stackoverflow.com/questions/39854720/cannot-get-sublime-text-3-command-line-tools-to-work