ERROR: While executing gem ... (Errno::EPERM) Operation not permitted

Roy Calderon picture Roy Calderon · Oct 1, 2015 · Viewed 93.9k times · Source

I just updated my Mac to OSX 10.11 El Capitan and some gems didn't remain.

The problem arose when I tried to run installations of different gems... e.g.:

> sudo gem install compass

Once I execute, I get the error:

> ERROR:  While executing gem ... (Errno::EPERM) Operation not permitted

This happens with other gems, as well...

I've run Homebrew and tried to install Ruby again, but nothing is working.

Answer

Roy Calderon picture Roy Calderon · Oct 1, 2015

I found the answer on SASS issues: https://github.com/sass/sass/issues/1768

Since OSX el Capitan there is a new security function that prevents you from modifying system files called Rootless. So you have 2 options:

  • If you install gems on /usr/local/bin there will be no problem because rootless doesn't affect this path.

  • sudo gem install -n /usr/local/bin GEM_NAME_HERE