Setting Up a Mac User Account for Building Web Apps

February 17, 2008

When I start a new project, I like a fresh and uncluttered workspace, so I created a new user account on my Mac. I needed development tools, so I added Firefox, Locomotive, iTerm, TextMate, and Navicat to the application dock.

Firefox needs a few extras to be useful for web development, so I added the HTML Validator extension (so I can check if my HTML pages conform to standards), the bookmarks extension (so I can get to my haphazardly organized collection of important reference web pages), and the Firebug extension (which is the only practical way I’ve found to figure out what’s going on with any complicated web page).

iTerm needed my favorite easy-on-the-eyes font, so I installed Inconsolata 14.

All that took about an hour.

Setting Up Mac OS X 10.5 (Leopard) for Rails Development

February 17, 2008

Here are directions for setting up Mac OS X 10.5 (Leopard) for developing a Rails web application. This covers everything you need to set up a Macintosh from scratch for Rails development. These instructions are suitable for a developer working offsite or independently (if you’re in an office with a support staff you probably don’t need this!).

These instructions make a number of assumptions about your development environment and requirements. This is what I used in a recent typical project.

  1. If the Mac has been used before, and there’s reason to save what’s already on the machine, back up all the user folders you want to keep to an external drive.
  2. You’ll need the disks that came with the Mac or disks from a Mac OS X 10.5 upgrade package. Do an “Erase and Install” to perform a clean install of Mac OS 10.5 (Leopard).
    1. Once the Macintosh HD is selected, click “Options.”
    2. Select “Erase and Install.”
    3. For “Format disk as” select the default “Mac OS Extended (Journaled).”
    4. Click “OK” and complete the Mac OS X installation.
  3. Create a new account with the name “Computer Administrator” (or something suitable for an account you will only use for system administration) and the short name “admin.”
  4. Create any user accounts you’ll need for yourself or anyone else using the machine.
  5. From the admin account, install the applications you’ll need for development. Here’s what I use:
    1. TextMate –
    2. iTerminal –
    3. Navicat –
    4. Firefox –
    5. Firebug –
  6. I like to use Locomotive as a graphical interface to manage my Rails projects. Before Mac OS X 10.5 (Leopard) was released, Locomotive offered an easy way to install a Rails stack on a Mac. Now it’s no longer needed to run Rails but it is still useful as an interface to start and stop an app, open iTerminal or TextMate, and preview an app in a web browser. You might want to try it, though it is not needed. If you are using Locomotive, go to to the Locomotive web site and download and install the “/usr/local” Rails bundle.
  7. Our team uses Skype and Pyro for interteam communication.
    1. Pyro –
    2. Skype –
  8. From the admin account, install the developer XCode Tools package:
    1. Double click the XcodeTools.mpkg package.
    2. On the “Standard install on ‘Mac HD'” screen, select “Customize”.
    3. Check “Mac OS X 10.3.9 Support”.
    4. Click “Install”.
  9. If you’ll be working with uploaded images (probably with attachment_fu), you’ll need to compile and install FreeImage at a later point in the process, in which case you’ll need some header files from an older version of Mac OS X. From the admin account, after installing the XCode Developer package, install the MacOSX10.3.9 developer tools package (this provides the old header files that you’ll need for compiling FreeImage later): Double click the MacOSX10.3.9.pkg file in the packages folder.
  10. Install the X Window System (X11) from the Leopard install disk when you install the XCode developer package:
    1. Install X11Documentation.pkg.
    2. Install X11SDK.pkg.
  11. You’ll need MacPorts to later install FreeImage and Git. Install MacPorts 1.5 to “/opt/local” using the package from
  12. Set the “/etc/bashrc” and “/etc/profile” files for the admin user and everyone else.
    1. Set aliases in “/etc/bashrc”
    2. Set the PATH in “/etc/profile”
  13. Modify the PATH environment variable in the “/etc/profile” file to add a path to “/opt/local” for Macports.
  14. Modify the PATH environment variable in the “/etc/profile” file to add a path to “/usr/local/mysql/bin” for MySQL (which you’ll add next).
  15. Compile and install MySQL 5.0.45 using the shell script at
  16. Check your MySQL version.
    1. In iTerminal, type “mysql –version”.
    2. You should see “mysql Ver 14.12 Distrib 5.0.45, for
      apple-darwin9.1.0 (i686)”.
  17. You may be using Subversion for revision control or you may need to download open source code that is only available via Subversion. Open iTerminal and make sure you have access to Subversion (“which svn”).

    1. In iTerminal, type “svn –version”
    2. You should see “svn, version 1.4.4 (r25188)” (or something similar).
  18. You may be using Git for revision control or you may need to download open source code that is only available via Git. Git does not come with Mac OS X 10.5 (Leopard) so you’ll need to install it using MacPorts: “sudo port install git-core”.
  19. Check your Ruby version.
    1. In iTerminal, type “ruby –version”.
    2. You should see “ruby 1.8.6 (2007-09-24 patchlevel 111)
  20. See which Ruby gems are installed with “gem list –local”. If you know which gems you’ll need for your application, you can install them now.
  21. Update to the current version of Rails.
    1. In iTerminal, “sudo gem update rails”.
    2. In iTerminal, “rails –version” should display
      “Rails 2.0.2”.
  22. If you’ll be working with attachment_fu and uploaded images, install Freeimage and Imagescience.
    1. Install Freeimage with “sudo port install freeimage”.
    2. If you receive any errors, check the install of XCode Tools.
    3. This discussion may be helpful:
    4. Install Imagescience with “sudo gem install -y image_science”.
  23. Log in to your user account and add your applications to the dock for easy access. This is a good time to look in System Preferences and set System/Accounts “Login Items” for applications such as Mail that you want to launch as soon as you log in.
  24. Get Mail set up properly for your user account.
  25. In your user account, set up the web browsers Firefox and Safari (and any others you’ll use) in the dock. You may want to set the Firefox home page to “http://localhost:3000/” so you’ll see your local development version of the your app when you launch Firefox. It’s a good idea to develop in Firefox so you’ll be developing to a standards-based browser. You may want to set the Safari home page to your production web site so you can see your app after it is deployed with a non-Firefox browser. Even better, set up Microsoft Internet Explorer running under VMWare Fusion so you check the app for browser compatibility issues.
  26. Set up Navicat to connect to your MySQL databases.
    1. Connect to your development database on “localhost.”
    2. You may also use Navicat to connect to your staging or production databases on your hosting server. But unless you have the authority and can take responsibility for the consequences, be cautious about modifying data on the production database!
  27. In your user account, create a folder for your Rails projects.
  28. Open iTerminal, change directories to your Rails projects folder, and create a new Rails application. Or find an existing open source application at GitHub and do a “git clone” for an application you want to modify.
  29. Build your Rails app.