Get Off My Lawn

Adventures of a Curmudgeon

Foiled by ':' or How I Finally Got RVM Installed

RVM is your friend!

Since RVM come onto the scene, I’ve heard great things about it. But everything I heard was in the context of Snow Leopard (Mac OSX 10.6). For reasons better left unsaid, I’m still on Leopard and was doubtful I would be able to take advantage of RVM.

So I did what most people do: I turned to Google. At first I didn’t find any helpful posts. However, one post stood out and I diligently followed its directions. I made sure I had the right version of XCode. I updated SQLite3. I then installed RVM. Here’s where the fun begins.

RVM plays hard to get

I followed the installation directions, updating my .bash_profile as instructed. I then restarted my Terminal session and patiently waited…WTF! My window disappeared! I finally was able to edit my .bash_profile and commented out the line that loaded ~/.rvm/scripts/rvm. Now what?

I then decided to manually source the rvm script in the hopes of seeing an error or something. No dice. Great! No output and my window keeps disappearing. I search the available help and troubleshooting guides: Nothing. I go back to Google: Nothing. I find nothing that is similar to my problem. sad trombone

So I head over to the IRC channel: #rvm on freenode.net. And a couple of folks start helping me out. First I tell them about some warnings I received during installation. I then reinstall (and rvm reload) upon their suggestion. No change in behavior. I tell them, “There’s no output and then after a second or two my Terminal session disappears.” They check my shell: echo $SHELL => /bin/bash. Nope that’s not it. They ask for rvm info. Well I have to run ~/.rvm/bin/rvm because I can’t load RVM as a function. The output looks ok. They ask about my .bash_profile; I also include my custom prompts, thinking I might have a problem there. Nope, all of that looks good.

In between the IRC exchanges I learn about set +e and set -x. Using those two, I’m finally able to see the output from the script and, as I had suspected, the script is stuck in an endless loop! Great! How do I debug that? BTW set +e means: Don’t exit on error and set -x means: debugging outputThe folks helping me are out of ideas; one even nukes and reinstalls RVM; it works for him. It must be something unique to my machine. I feel I’m in store for a lengthly and, quite possibly, fruitless search. Thankfully I have some output captured, early output before the session window disappears. I load up MacVim with the scripts and start looking at each line, comparing it to the output.## Foiled by ‘:’ As I was going through the output I noticed a ‘cd ..’ command. I couldn’t find it in the scripts. Thinking, “somewhere they have to be ‘cd’ing because it’s in the output.” And then it dawned on me: wait a minute, I have ‘:’ aliased. Just at that moment I was pinged from IRC. I excitedly replied that I might hove found the problem. On line 40 of ~/.rvm/scripts/initialize is: : \. Substituting my alias for ‘:’ the output matches; it’s trying to ‘cd’ into several directories. I remove the alias and reload my Terminal session.Drum roll please: rvm is a function. SUCCESS! Now I can take advantage of RVM.Funny thing is: no one thought to ask about my aliases. Assuming I would know that ‘:’ is null, a do nothing command. I do now. And hopefully this will help someone else with similar problems in loading RVM.Cheers!