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

Kurr0
  • 653

2 Answers2

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.

Haru
  • 876
-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.

Eric P
  • 11
  • It does not help to solve the issue. Sometimes you just need symlinks in /usr/bin and cannot avoid that. – User366 Sep 20 '16 at 09:57