55

I was installing nodejs for Symphony when I hit an "Operation not permitted" error. Anyone know why this happened?

MacBook-Pro-de-XXX:~ XXX$ sudo ln -s /usr/local/bin/node /usr/bin/node

Password:

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

4
  • 1
    First check whether /usr/bin/node is already set up. If you want to change it, you can use ln -sf to force the symlink.
    – user2182349
    Jul 16, 2015 at 11:55
  • MacBook-Pro-de-XXX:~ XXX$ which node /usr/local/bin/node
    – Kurr0
    Jul 16, 2015 at 11:57
  • ls -la /usr/bin/node
    – user2182349
    Jul 16, 2015 at 11:57
  • MacBook-Pro-de-XXX:~ XXX$ ls -la /usr/bin/node ls: /usr/bin/node: No such file or directory
    – Kurr0
    Jul 16, 2015 at 12:03

2 Answers 2

72

This is the so called "rootless" mode in the new version of OS X. It effectively makes certain system directories read-only (even for admins). "/usr" is one of those protected directories (the only subdirectory that is excluded from this rule is "/usr/local")

One can disable this rootless mode with the following commands:

$ sudo nvram boot-args="rootless=0"
$ sudo reboot

But this is not recommended! The best practice is to install custom stuff to "/usr/local" only.


Update (27-Oct-15): 10.11 (El Capitan) Public Release

Please note that the above described workaround will not work with the public release of El Capitan anymore as Apple has changed things around.

The proper way to disable the "rootless" mode (aka System Integrity Protection, "SIP") is to boot temporarily into Recover Mode (hold Command+R during boot) and use the csrutil disable command (or csrutil enable to reenable) from the Terminal. The Terminal is reachable via the menu of the Installer that launches in Recovery Mode.

5
  • 2
    Might not be advisable, but for now MacTeX seems to expect /usr/texbin, so away we go!
    – David Lord
    Jul 29, 2015 at 9:43
  • Modifying NVRAM to disable rootless mode doesn't work on El Capitan from (at least) the GM version forward. Check this answer for the method that works in the version that is out now: stackoverflow.com/questions/32590053/… Sep 17, 2015 at 15:51
  • This not worked for me too.
    – gsscoder
    Oct 26, 2015 at 7:14
  • 1
    still give me Operation not permitted
    – Sinux
    Feb 4, 2016 at 6:21
  • 2
    My workaround was to install to /usr/local/bin Feb 23, 2016 at 18:33
-2

In my version of El Capitan the /bin directory did not exist :

/usr/local/bin

So, the fix was :

mkdir -p /usr/local/bin

The -p flag will create the dir (and incidentally any dirs in the full path) if it does not exist.

Then you can create symlinks & copy apps to /usr/local/bin because /usr/local not part of the "rootless" mode.

1
  • It does not help to solve the issue. Sometimes you just need symlinks in /usr/bin and cannot avoid that.
    – User366
    Sep 20, 2016 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .