Ruby 1.9.3 on Mac OS X version 10.7 (10.7.3 to be precise)
I already know a number of programming languages, but as we are moving to a couple of tools that utilize Ruby, it became clear that I needed to break down and learn ruby. Working on MS Windows and Linux getting various versions installed has not been an issue. It is only when I went to use version 1.9.x on my MacBook that I realized this was not as simple as I hoped.
There are two main branches when it comes to Ruby: 1.8.x and 1.9.x. While both work fine, there are a number of improvements in the 1.9 stream, and as such I wanted to learn on this one. On my linux machines I was using RVM to manage different installations of Ruby without issue. You can go over to RVM for instructions on how to install RVM. Note: Close your Terminal and reopen so that the environment is properly sourced.
The problem is when you go to install 1.9.x or anything with RVM. I was getting the following errors:
mymachine:~ myusername$ rvm install 1.9.3 Compiling yaml in /Users/myusername/.rvm/src/yaml-0.1.4. Error running 'make ', please read /Users/myusername/.rvm/log/ruby-1.9.3-p125/yaml/make.log Database file /Users/myusername/.rvm/config/packages does not exist.
Turns out ‘make’ was not installed.
To install ‘make’you have to do a couple of things. First, you need to install Xcode. You can get this from Apple.
This will only get you part of the way. Next you need to login to the Apple Developer network. At least you can use your Apple ID to register, and install the command line tools. This is the page with ‘Command Line Tools for Xcode’. Download this and install it, and you will be 90% of the way to getting RVM working.
Now, when you go to run ‘rvm install 1.9.3′ you will get an error similar to ‘There has been an error while running configure. Halting the installation.’ You need to add an option to rvm to get it to work.
$ rvm install 1.9.3 --with-gcc=lang
After running it like this you should have the following.
interloper:rightscale myusername$ rvm install 1.9.3 --with-gcc=clang
Fetching yaml-0.1.4.tar.gz to /Users/myusername/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/myusername/.rvm/src
Configuring yaml in /Users/myusername/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/myusername/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/myusername/.rvm/usr
Installing Ruby from source to: /Users/myusername/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/myusername/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling
ruby-1.9.3-p125 - #installing
Retrieving rubygems-1.8.15
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 245k 100 245k 0 0 356k 0 --:--:-- --:--:-- --:--:-- 1386k
Extracting rubygems-1.8.15 ...
Removing old Rubygems files...
Installing rubygems-1.8.15 for ruby-1.9.3-p125 ...
Installation of rubygems completed successfully.
ruby-1.9.3-p125 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p125 - #importing default gemsets (/Users/myusername/.rvm/gemsets/)
Install of ruby-1.9.3-p125 - #complete
interloper:rightscale myusername$
TLDR — for those with add or no need to read it all.
1. Install RVM
2. Source shell or restart Terminal program
3. Install Xcode
4. Insall command line tools for xcode
5. Run command ‘rvm install 1.9.3 –with-gcc=clang’
Hope this helps.
February 16, 2012
|
Posted by jobu
Categories:
Tags: