So, another thing that I haven’t spent the time to fix on my Mac at home is this issue:
ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
This has come up ever since upgrading to El Capitan and the way Apple changed things that I don’t really understand. You can read about it here, OS X El Capitan screwed up Ruby gems, and how to fix it. Although I didn’t follow the fix (well, at least not today, there is a good chance I did it ages ago!). A search for Ruby and El Capitan will bring up lots of posts about it, it has to do with Apple’s System Integrity Protection (SIP) feature.
Anyway, coming back to todays error. This was following trying to use Rails Composer. Did a google search with the above error and got loads of results. Looked at the first three and came across this Stackoverflow answer, the one about using a Ruby version manager. I knew that it was something to do with my path. Which didn’t have “rbenv” in it even though I was using that. (Actaully it had “.rvm” as I had been using that and thought I had got rid of it all when I made the switch to rbenv!)
So, after sussing out a few things, changed my path in my .zshrc file (note: using zsh not bash!) to:
Making sure I had changed to the ruby version I wanted (rbenv local 2.3.0 – I also changed global to this as well) and then did rbenv rehash (remember to do this step.
Also added this in:
if which rbenv > /dev/null; then eval “$(rbenv init -)”; fi
That is all probably not that helpful, as a lot of it was trial and error. Some good links to keep handy:
Using rbenv to Manage Rubies and Gems – have only just found this!
This could be useful if you are just starting out – https://gorails.com/setup/osx/10.11-el-capitan.