Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sublime symlink disappeared after upgrading to El Capitan

I have just upgraded to OS X El Capitan and subl . command stopped working with the zsh: command not found: subl error message.

I have run the following command as suggested in other posts:

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

result:

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

in the ".bash_profile" as well as ".zsh_profile" I have the following lines saved:

export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH export EDITOR='subl -w' 

Also tried:

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

result:

ln: /usr/bin/subl: Operation not permitted 

Update: it seemed to work after running the following command:

alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'" 

but as soon as I restart the terminal, subl . command stops working.

Update2: after pasting the following line: alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'" in the subl ~/.zshrc, subl . command works even after restarting the terminal, but terminal seems to work slower than normal, and when you open relatively small folders with subl . command, at times it's taking ages to show the files...

Final Update: After running sudo rm /usr/local/bin/subl followed by sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl everything works perfectly, thanks to @chris.

like image 721
Anvar Turobov Avatar asked Oct 02 '15 20:10

Anvar Turobov


People also ask

What is SUBL command?

Sublime Text includes a command-line helper called subl . Using the command-line helper, you can open files and folders and perform other actions from the command line. Before using subl , make sure it is on your PATH . To put subl on your PATH , you may need to add directories to PATH or use symbolic links.

How do I start sublime text from terminal Mac?

First, navigate to a small folder in Terminal that you want ST to open and enter the following command: /Applications/Sublime\ Text. app/Contents/SharedSupport/bin/subl . NOTE: You may need to replace Sublime\ Text.


1 Answers

In El Capitan, you are not allowed to write to /usr/bin, but writing to /usr/local/bin is ok. By default, /usr/local/bin should also be in your path variable.

Had the same issue. Deleting and recreating the symlink has fixed the problem. Perhaps the current symlink is pointing to the wrong location after the upgrade.

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

Or Sublime Text 2 (from – @simen comment):

sudo rm /usr/local/bin/subl sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl  
like image 140
chris Avatar answered Sep 19 '22 21:09

chris