Post RVM install issues on Mac OS Mountain Lion

Tonight I installed RVM on my MacBook Pro in order to use multiple versions of Ruby side by side. I ran into a number of issues:

Issue 1: Failed to build gem native extension

After installing RVM and ruby 1.9.4 I needed to install some gems but running the gem installer resulted in the following error:

ERROR:  Error installing mechanize:
ERROR: Failed to build gem native extension

The solution:


Download and install the gcc installer for Mac OS from here:


https://github.com/kennethreitz/osx-gcc-installer


The source:


This tip came courtesy of Alex Zak on stackoverflow. It looks like gcc used to come bundled in XCode’s command line tools but no longer does.


http://stackoverflow.com/questions/9552292/failed-to-build-gem-native-extension


 


Issue 2: Gems I installed were not visible


This time the gem install worked and I didn’t receive the above error message. However, when I attempted to run my application the require statement failed and executing gem list did not show my gems.


The solution:


Running the following command fixed my issues:



rvm use ruby-1.9.3-p125 --default


 


The source:


The resolution came from pcragone on stackoverflow


http://stackoverflow.com/questions/9622467/after-installing-ruby-gems-running-the-new-gem-returns-could-not-find-errors


 


Issue 3: OpenSSL certificate verify failed


Running an application that previously worked I received the following error:



OpenSSL certificate verify failed


The solution:


I’ve seen this on Windows before but never on my Mac. Because I’m using RVM, the solution was pretty straightforward, using the following commands to fix the issue:


$ rvm remove 1.9.3 (or whatever version of ruby you are using)
$ rvm pkg install openssl
$ rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr

The source:


The railsapp blog on github has a nice writeup on this


http://railsapps.github.com/openssl-certificate-verify-failed.html


 


The End


I hope this helps someone as the original sources helped me tonight!

Post a Comment

Popular posts from this blog

Getting Started with Mirth (Part 2)

Mirth

Visual Studio 2012–Debug in Chrome Incognito Mode