Sublime Forum

OS X Command line


When trying to add ```
ln -s “/Applications/Sublime” ~/bin/subl

I get ''operation not permitted'
I also cannot move the Subl bin file into my bin folder as cannot change the permissions on my bin folder.
I'm using macOS Catalina 10.15.7


Did you create a bin directory in your home directory first? Or rather is there a directory by that name there?



Hi, Yes there is a bin directory but I can’t change permissions to move files into it.



That seems rather curious, since you generally have access to files in your own home directory (unless someone else created them or the like). What’s the result of runningt these two commands:

cd ~
ls -alF | grep bin


markwilkinson@Marks-MacBook-Pro-2 ~ % cd ~
ls -alF | grep bin
lrwxr-xr-x 1 markwilkinson staff 8 20 Nov 04:41 bin@ -> /usr/bin
markwilkinson@Marks-MacBook-Pro-2 ~ %



Your issue is that the ~/bin is a symlink to /usr/bin, which is a protected location.

You may be able to get the command to work by using sudo by adding that to the start of the command:

sudo ln -s “/Applications/Sublime” ~/bin/subl

I can’t remember offhand if that’s something that’s preinstalled and set up out of the box on MacOS though (it’s been ages since I set mine up). Failing that, logging in as an administrator account to do it may work as well (though in that case you want to replace the ~ in the command with your home directory (/Users/yourusername) or it will put the link in the admin account’s ~/bin instead.



Tough one,
Using sudo doesn’t seem to work
markwilkinson@Marks-MacBook-Pro-2 ~ % sudo ln -s “/Applications/Sublime” ~/bin/subl
ln: /Users/markwilkinson/bin/subl: No such file or directory
markwilkinson@Marks-MacBook-Pro-2 ~ %

Neither does using my user name
markwilkinson@Marks-MacBook-Pro-2 ~ % ln -s “/Applications/Sublime” /users/markwilkinson/bin/subl
ln: /users/markwilkinson/bin/subl: Operation not permitted
markwilkinson@Marks-MacBook-Pro-2 ~ %

I just read this below on a forum;
This is due to a security feature of OS X called System Integrity Protection , which will protect against unauthorised access to system locations and processes. So if this feature is enabled , you won’t be able to modify the content of /usr/bin.



Ok found the solution have to use /usr/local/bin
I have permission to access this bin and can add the file, now it all works

1 Like