When I execute on osx El Capitan:
sudo gem update --system
I got the error:
Updating rubygems-update
ERROR: While execut
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.
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!
I do have this problem when I try to uninstall and reinstall cocoapods. After searching, I found the solution is temporary disable the System Integrity Protection then Re-enable System Integrity Protection when works done.
Here are the steps.
1) Reboot your MAC and hold down Command+R until you see the Recovery Mode screen boot up.
2) In this Recovery Mode, look at the top file menu 'Utility' and select Terminal to open the Terminal
3) Enter this command below
csrutil disable / reboot
Your Mac will reboot now, once it reboot to normal screen, you can check to ensure you have disabled the System Integrity Protection by open the Terminal again and enter the following code
csrutil status
Now you can carry out the task you want to carry out.
4) Re-enable System Integrity Protection Once you have your works done, it is STRONGLY recommended that you Re-enable the System Integrity Protection
5) Reboot your Mac to Recovery Mode again. (Hold down Command+R key)
6) Open Terminal when you are in the Recovery Mode screen
7) Enter the following code
csrutil enable /reboot
Again, to ensure you have Re-enable the System Integrity Protection, after reboot, use the Terminal to check using
csrutil status.
Hope this help anyone who have the same issue.
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 ...
I also encountered this problem when upgrading cocopods, my operating system is macOS Sierra , ruby version is 2.0.0.The following way to solve my problem.
Through the homebrew upgrade your ruby version.
brew upgrade ruby
If you fail to update ruby, this link can help you.
https://github.com/Homebrew/legacy-homebrew/issues/49895
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