Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Operation not permitted - /usr/bin/update_rubygems

Tags:

rubygems

ended up installing ruby via homebrew. Install homebrew first:

http://brew.sh

then execute

brew install ruby

after that it worked flawlessly. It has something to do with the native ruby installation.


If you're having issues installing a specific gem after installing ruby through Homebrew (as advised above), try the following:

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

Found this thanks to user endoplasmic on this issue thread: https://github.com/sass/sass/issues/1768


Starting with El Capitan, Apple prevents user applications to modify /usr/bin for security reasons. So just install/update rubygems in the recommended folder, /usr/local/bin:

sudo gem update -n /usr/local/bin --system

This is an 'issue' (Apple calls it a feature) of 10.11. Basically, you can't modify /usr/bin in 10.11 (not even as root (sudo su -), there are a number of other folders that also cannot be modified).

If you run ls -l /usr/bin you will notice that permissions are 555, or r-xr-xr-x (no write access). You cannot change these permissions using chmod.

This feature has the slightly incorrect name: 'rootless'. Apple says it is a security measure:

https://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really

You can revert the feature using this gist:

https://gist.github.com/djtech42/7233c602fda912d96fdf

#!/bin/bash
#Beta 4 to Final Public Release (Must be run in Recovery Mode)
csrutil disable

#Beta 1-3
sudo nvram boot-args="rootless=0";sudo reboot

P.S. Some users say this doesn't work, and that you must boot into recovery first, as they do here:

https://www.macbartender.com/system-item-setup/

I'm not recommending you do that. The best solution, is to just install ruby (and almost anything else) through Homebrew, since you still have write access to /usr/local, until Apple decides that is too insecure ...



For those that are still having this issue, basically it was a security upgrade that Apple release in the new OSx. It's a System Integrity Protection which is basically a "rootless" security system. Follow these steps to disable:

http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/

Take Note This should only be done if you understand what you are doing and why!