Gem Error

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:

$HOME/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

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:

https://github.com/rbenv/rbenv

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.

NumPad not working in iTerm2!

I’ve recently decided that I am going to start blogging errors, problems and code I find useful. I have a Google Doc with Tips on lots of things and I have an Errors doc that I started when studying at Enspiral Dev Academy.

I have kept referring back to my errors doc and more and more to my Tips (at work) doc. So, why not share openly for others?

I have just been doing some work on my MacBook at home and my keypad (wire keyboard) hasn’t been working for ages (but I haven’t spent the time to fix it). So did a quick search, first hit was this Fix for iTerm2 Numeric Keypad Not Working, solution:

in iTerm2, go to preferences>profiles>keys and select  “xterm with numeric keypad” from ‘load presets’.

Screen Shot 2016-02-08 at 3.48.44 PM.png

Have just read this though, https://gitlab.com/gnachman/iterm2/issues/702, hopefully I won’t come up against any other issues with the keyboard now!