Monday, February 27, 2012

Installing Ruby 1.9.3...or How to Kill your Computer Quickly

The beginning of my experience with Ruby on Rails was, in all honesty, really pretty frustrating.  Initially I spent some time using websites Ruby in 20 Minutes  and Try Ruby to get the basic feel for Ruby.  Through these I learned some basic commands and how the coding works to assign meaning to objects and to recall them.  I learned enough to get dangerous, knowing I could return to the forums and wealth of sites on the interwebs when I need more help teasing out how to make the code do what I want once I had something to work on.  I find that I get really impatient learning code for it’s own sake—I want something to play with.

Naturally then, since I wanted to work on Ruby on Rails, I moved along to getting Ruby on Rails installed on my computer.   This process took me an embarrassing amount of time.  It all started with installing the most recent version of Ruby.  I’m a Mac user, so Ruby 1.8.7 comes preinstalled on my machine.  To run Ruby on Rails, however, I needed at least 1.9.  The latest version is 1.9.3.  To do this install, I relied upon terminal and a number of really thorough websites and forums with advice on troubleshooting this install process.

Basically, I started by installing Ruby Version Manager (RVM), then I checked for the requirements for running RVM ($ rvm requirements).  When I did this I got the error message below. 

Code for rvm requirements that ends with a warning about Xcode 4.2.
Screen Cap of RVM Requirements Error

This told me that when I ran the install command, I would need to amend the command with I ran the function again with –-with-gcc=clang.  So, learning that I made sure I had GCC and entered the following into the command line:  rvm install 1.9.3 –with-gcc=clang.  This asks that Ruby Version Manager install Ruby version 1.9.3 using GCC as the C language compiler.  Fancy stuff.

Screencap of rvm install 1.9.3 --with-gcc=clang that ends in a make error that calls for installation halt.
Screencap of "make" error
Sounds great.  But it didn’t work.  This time I got a “make” error.  I spent an inordinate amount of time researching this error and try a variety of things to try to fix them.  Finally, one shady sudo command (which is a command that allows the program administrative privileges)  caused me to not be able to run RVM commands at all.  Something was really odd about terminal at that point.  So I restarted my computer, only to get this error:

Macbook Pro with a fatal error on boot up
An iPhone photo of something that you don't want to see your Mac Do

This message ushered in a way of panic I care not to experience again any time soon.  After some research (and the research of my dear buddy, Mat Reynolds), I realized that I could reinstall Lion on my computer and it would probably fix the error.  So, I booted the computer using the Recovery HD and told it to reinstall Lion.  Everything was there, happy and fine, as it was before I started playing around in Terminal.  <sigh of relief />

So—lessons learned?

I learned quite a bit about the command line.  I learned the basics of Ruby, but also quite a bit about Terminal.  I learned what commands like bash and sudo do and the power the later has over the computer.  From this experience, I decided that in the future it might be better to work on playing around in terminal from the other side of my partitioned harddrive, so that I don’t mess of my REAL workspace.  About two years ago I (okay, my husband) partitioned my harddrive and installed windows on one half.  At the time I did this because the web conferencing software used in ODU’s distance PhD classes was Windows only and I refused to have a window’s machine in my house.  When my computer was failing to load on the Mac side, the Windows side could still load easily.  I decided from this that I should either wide the Windows side and install a second version of Lion on that side, or perhaps Linux, so that I could keep my files safe from my dangerous play.  

No comments:

Post a Comment