No More Excuses! Using RVM to Play with Rails 3

Now that Rails 3.0 is out, it's high time to start using it. But what if you want to keep Rails 2.x around for your current projects? Fortunately, on OS X, there's a simple solution: RVM.

Once you've installed RVM, you'll need to install a version of ruby compatible with Rails 3. There are two choices: 1.8.7 and 1.9.2. Given its new features and speed improvements, 1.9.2 is the one to choose, unless you have particular dependencies on 1.8.7.

Installing 1.9.2 is simple: rvm install 1.9.2. This will download, compile, and install 1.9.2 to a .rvm folder in your home directory.

Once that's done, type rvm 1.9.2 to switch over and rvm info to confirm that you're now running 1.9.2. Note: this will only apply to the current terminal window, here's how to make it the default.

Type gem list and you should see just two gems: rake and bundler.

Now go ahead and install Rails 3: gem install rails. Confirm by way of rails --version and gem list.

That's it, you're done... Now have fun!

What to go back to your previous version of ruby? Just type: rvm system and you'll revert back to your standard ruby installation and the gems that went with it.

Steps to coax The Gimp into compiling under Macports

Macports is a great tool to easily install a ton of open source software on your Mac. The packages are generally very well maintained but that can be a little tough for very complex ones like The Gimp, the best (?) open source image processing software out there. Though you can download a prebuilt version of The Gimp, I wanted to build my own in order to leverage some third party plugins, like Tilt Shift photography.

If you haven't yet, install Macports.

Then kick things off with "sudo port install gimp". This will likely generate a very impressive list of dependencies and start chugging through them. Expect this to take hours, not minutes. Hopefully, it will build cleanly all the way through. If not, the following notes may be of use... 

My first failure (bug #26084) was quickly resolved thanks to the lightning support of the Macports maintainers (kudos to ryandesign [at] Turns out I was a building a slightly out of date package. Following the advice to "sudo port selfupdate" and "sudo port clean libgnomeui", the build proceeded smoothly.

The next build failure was already captured by bug #25962. There are three errors listed, though I only saw the first two. These were easily addressed with a couple of "ln -s" commands as described in the bug. I also installed select_python ("port install python_select") and pointed it to python2.6 as described in the comments.

The final bug occurred when building gimp itself. You can check out #26095 and its simple fix.

DTerm: Useful Omnipresent Command Line for OS X

Found this sweet free utility called DTerm recently. It enables you to pull a context-aware pop-up that you can use to run command line utilities from whatever program you're currently using. What do I mean by "context-aware"? DTerm will automatically change directories to the one your program is currently in. Moreover, for those of us using multiple spaces, any programs you run from DTerm will open their windows in your current space.

Here's an example. Say I want to package up a bunch of images. Simple: hit Shift-Cmd-Return to invoke DTerm, its window overlay on the Finder's, and I can then run a "tar" command. That's it. I could even stay in DTerm and copy pics.tgz to a different drive, or scp it to another server.

This is a very useful tool. Here are a few other things you can do with it:
  • Quick calendar: "cal" will display this month's calendar, hit Shift-Cmd-C and you'll have it in your clipboard (cal 2010 will give you this year's calendar)
  • Starting TextMate: Typing "mate ." from a Finder window will open TextMate in project mode in the current directory
  • Comparing files: Select 2 files in the Finder, run DTerm, type "cmp" or "diff" then Shift-Cmd-V to paste the names of the files you selected into DTerm
  • MD5 checksum: Select the files you want to sum and run "md5" + Shif-Cmd-V
  • Info on all files in the current directory, including hidden ones: "ls -al"
  • Create a series of folders in the current directory: much faster to type "mkdir foo bar foo/bar" than to use the Finder
  • Quick lookup info on a domain: "dig"
  • Want your mac to read you something? Select some text, copy it, invoke DTerm and type "say" followed by pasting the text surrounded by quotes
  • Byte, word, line counts: "wc" and the file(s) you're interested in

Not all these examples require DTerm's features but having a terminal window at your fingertips, without needing to switch context, is very useful.

And it's another reason to make better use of all those command line utilities!

Hat tip to @azaaza for the pointer.