Devigner blog about development and design

Jumping From a Locomotive

Since I started working with Ruby, I have been using the excellent one-click installer Locomotive. Locomotive has some great bundles and includes rails 1.1.2, but lately I’ve had this nagging urge to geekify and strictly use my terminal, or I should say iTerm.

Making the switch was going to be a fairly easy task, or so I thought. I followed Dan Benjamin’s narrative at Hivelogic, paying close attention to his instructions on adding the path to my .bash_login file.

Once again, be sure that your path precedence is for /usr/local/bin before /usr/bin or else things won’t work correctly. This can be accomplished with the following lines in a file called .bash_login in your home directory:

PATH="/usr/local/bin:/usr/local/sbin:$PATH" export PATH

Be sure to close Terminal and open a new one prior to running the commands below.

I also did a test on the bash_login by running the command: `~/.bash_login` which returned nothing, as it should. This alone left me under the impression I was on the right track (pun intended).

I completed all tasks, installing ruby, rails, lighttpd, pcre, etc., then went to start working on some existing projects from my Locomotive install. Firing up webrick immediately told me I had a problem. ruby script/server returned errors. My Mac couldn’t find Ruby. I doubled checked the install ruby -v which came back with Ruby 1.8.2. As we all know, Ruby ships with Tiger at version 1.8.2, but it’s broken. The installation I just completed was for 1.8.4. So why is it returning the older version?

I immediately suspected that the problem was in my .bash_login file. so `mate ~/.bash_login` opened the file in TextMate. Sure enough, my path was correct.

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

I did some research and found that .bash_profile overrides .bash_login, so I checked my .bash_profile and edited it to match what I have in my .bash_login file, restarted iTerm and violla, everything is working now.

Somewhere in the middle of all this, I found that TopFunky has made available a nice little script that installs everything you need with one shell command. His script does everything including MySQL 4.1.1. If you download this script and already have MySQL installed, just open the script in TextMate and comment out the commands for it which are located at the bottom of the file. I wish I had stumbled on this one sooner. It would have saved me alot of typing commands.

Either way, my problem resided in the bash_profile vs. bash_login. If you have problems similar in nature, double check these. You can run both, Locomotive and the native ruby install since Locomotive does not install ruby in the same location.