54

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

migrated from stackoverflow.com Jul 16 '15 at 17:32

This question came from our site for professional and enthusiast programmers.

  • 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 '15 at 11:55
  • MacBook-Pro-de-XXX:~ XXX$ which node /usr/local/bin/node – Kurr0 Jul 16 '15 at 11:57
  • ls -la /usr/bin/node – user2182349 Jul 16 '15 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 '15 at 12:03
70

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.

  • 2
    Might not be advisable, but for now MacTeX seems to expect /usr/texbin, so away we go! – David Lord Jul 29 '15 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/… – Chris Ostmo Sep 17 '15 at 15:51
  • This not worked for me too. – gsscoder Oct 26 '15 at 7:14
  • 1
    still give me Operation not permitted – Sinux Feb 4 '16 at 6:21
  • 2
    My workaround was to install to /usr/local/bin – anon58192932 Feb 23 '16 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.

  • It does not help to solve the issue. Sometimes you just need symlinks in /usr/bin and cannot avoid that. – Dmitry Dulepov Sep 20 '16 at 9:57

You must log in to answer this question.

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