Symbolic link into /usr/bin in Mac Os Catalina

Viewed 1153

In order to start Sublime Text editor from terminal in my mac, I used to do this:

sudo ln -s path_to_sublime /usr/bin/subl

and after this, I launched Sublime from terminal like this :

$subl

In this version of Mac OS (Catalina), I'm getting an error while creating the symbolic link :

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

I think, they added a security layer... Do you know how can I fix this ?

2 Answers

Thou shalt not mess with /usr/bin. Instead, make the link somewhere else and prepend its location to your $PATH.

% ln -s mything /opt/local/bin/mything
% export PATH=/opt/local/bin:$PATH
% which mything
/opt/local/bin/mything

and to make it permanent for your zsh:

% echo "export PATH=/opt/local/bin:$PATH" >> ~/.zprofile

The command to run the Sublime app would be

open -a Sublime

To make an alias of this, you would issue

alias subl='open -a Sublime'

To add this to your zsh more permanently:

echo "alias subl='open -a Sublime'" >> ~/.zprofile
Related