When I execute on osx El Capitan:
sudo gem update --system
I got the error:
Updating rubygems-update
ERROR: While execut
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 ...