Installing gem fails with permissions error on OSX

If your ever have a problem installing or updating a gem in OSX.

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

You should know that OSX came with a Ruby version for their own use, and we shouldn't modify that version.

So we are going to install a separate version of Ruby in our system, using rbenv to manage this instance. For me the easy way to do it in OSX was using Hombrew.

brew install rbenv ruby-build

However you could follow the link above for more information and details about how to make Ruby works properly in our Mac.

source