Friday, January 18, 2008

What's your Mac/Ruby setup?

I've been having a nightmare getting Ruby and RubyGems playing nicely on my Mac. I wanted to get the latest (stable) version of Ruby so the one that comes pre-installed with OS X was no good. Somehow, when I first tried to install Ruby and RubyGems using DarwinPorts I ended up with ruby in /usr/local and gem in /opt/local. This caused issues from my terminal since I didn't have both these in my path - so this was the first thing I had to fix (by adding some paths to my .profile file).

One annoyance while I was doing all this was I was having to run the port and gem commands as an administrator. The login I use for my development work isn't an administrator so I have to keeping switching to an admin account in my shell and invoking the commands that way. However, the way I understand it, that means any environment variables ($PATH and $GEM_HOME are the two that seem to have reared their heads for me here) are now the admin users'. I don't really want to have to have my dev user's environment set to the same as the admin one. I'm thinking that I've got into a mess here and I need to do one of two things:
1. Do a private install of Ruby and RubyGems just for my dev user, or
2. Make my dev user an administrator.

I'm leaning towards 1 at the moment.

Recently I installed NetBeans, hoping to use it to debug my Ruby apps but I got a problem with RubyGems again. The issue was that it couldn't find the gem command, presumably because the modified path in my .profile file isn't picked up my OS X.

No comments: