Martin Ström

My Terminal Setup for Rails Development

I’m quite happy with my setup right now for the Rails projects I’m working on and wanted to share the bits and pieces I use.

First, I found a SIMB plugin for Terminal that’ll show the tab’s title in the tab instead of the running process. I use the plugin with a simple title helper in my .bash_profile to set the title simply.

function title () {
  unset PROMPT_COMMAND # more on this later
  echo -ne "\e]0;$1\a"

# Usage:
# title 'my title'

Second, I use a technique I saw on how to automatically set the title to display the current working directory as title, but since I use the plugin and helper function above, I could simplify the PROMPT_COMMAND a bit:

function set_window_and_tab_title {
  local title="$1"
  [[ -z "$title" ]] && title="root"
  echo -ne "\e]0;${title}\a"

PROMPT_COMMAND='set_window_and_tab_title "${PWD##*/}"'

That’s why I unset PROMPT_COMMAND in my title function, so it won’t auto update when I choose to set it manually using the title function.

The last piece is an updated version of my old Rails Term-script for iTerm which has been updated (and improved) for the Terminal in Mac OS X Leopard instead of iTerm.

It will open the tabs I usually use when doing Rails development and set the title of each tab using the above mentioned functions. You need to enter you projects root directory and the projects you want to have easy access to. I’ve added some comments to the AS code to help you out.

Download a zipped version of the AppleScript. Just drag the script to the Script Editor (/Applications/Utilities) to edit it.

All source code for these scripts can also be viewed on Pastie. Let me know if you have any improvements.

Mac OS X 10.5.1 and Multi-Safari

Seems like Multi-Safari (at least 2.0.4) broke when upgrading to Mac OS X 10.5.1. I get this error:

“You cannot use the application ‘Safari 2.0.4′ with this version of Mac OS X.”

Luckily, I’ve found a workaround. Just launch Safari from the command line ( that is) and it should work for you:

/Applications/Safari\ &

CSS is in progress