I’m having trouble installing Ruby using the following instructions on page 25 of Build Your Own Ruby On Rails Web Applications by Patric Lenz. It refers to installing Ruby on Mac OS 10.4, which is what I am using on a brand new MacBook. I installed Xcode and readline first as instructed.
With Readline in place, we’re now able to install Ruby itself. Type out the following series of commands, exactly as you see them here. It’s not important that you understand every line, but it is important that you don’t make any typos. This step might also test your patience somewhat, as the configuration step may take half an hour or more to complete, depending on the speed of your system and your network connection.
How did you go? It might be prudent at this point to run some checks, to determine whether our installation is on track so far. The simplest and safest way to tell whether our Ruby installation is working is to type the following command into the Terminal window:
$ ruby –v
The version that you should see displayed is ruby 1.8.4 (2005-12-24), as shown in Figure 2.8. If anything else is displayed here (such as ruby 1.8.2 (2004-12-25)), something has gone wrong. You should carefully repeat the instructions up to this point.
Hmm, you're probably pointing to the existing version of Ruby that comes with Mac OS X.
I've never installed ruby purely from its source before - I use MacPorts (aka Darwin Ports), which technically speaking does install ruby from source but it is managed in a ports (think packages) system.
Before you look into doing this via Darwin Ports though, I think you can fix this problem by adding /usr/local/ruby/bin to your PATH environment variable.
You can easily verify which 'ruby' executable you are running by entering
in a terminal. It's probably pointing to the default Mac OS X one rather than the one you installed in /usr/local/ruby.
Thanks Redemption, I think you were right that I didn't have the PATH envirnment variable set right. I redid it and ran the installation again. This time it worked correctly. Thanks for clueing me in on the "which ruby" command. It was a big help.
I never bother with any of this; I use Locomotive for RoR, and MAMP for, well, the AMP. Depends on what you really need, of course, but the simplicity of those two combos beat out anything else I've heard.
On page 19 of Patrick Lenz's book there is the following footnote.
"There is an all-in-one installer available for Mac OS X, called Locomotive [http://locomotive.raaum.org/]. Unfortunately, it ships with the SQLite database server, instead of MySQL. It’s not that I have anything against SQLite as a database, but in a book that’s already covering all operating systems, there’s only so far one can go to cater for possible combinations of technologies. For this reason, I don’t recommend that you use Locomotive to work through this book."
That is why I choose not to use locomotive. I'm using the book to learn RoR.
gwb3- Yeah, that's somewhat unfortunate, though I don't use it either. That's why I'm usually running an instance of MAMP at the same time. I have Rails talk to the MySQL database that MAMP provides and I call it a day. It works well for me: two apps that I can start really quickly (MAMP has a nice dashboard widget always a click away), MAMP provides phpMyAdmin, and they're all compartmentalized so that if for some reason I muck up in one environment, I can just reinstall or create a new environment. For example, for some reason or another I have version x of Rails in one project and version y of Rails for another project- with Locomotive I can switch back and forth without any work at all.
I too am installing Ruby using the instructions in this book and if you've completed the installation and the command 'ruby -v' is still saying you have a version other than 1.8.4 installed, simply close terminal and try running the command again. It should be updated. It was for me.