Transferring a Ruby on Rails Development Environment (OS X Tiger)

Valid as of December 19, 2006. Now that the semester is over, I’ve found some time to move my ClaimID development environment to my new laptop. The install process was a little bit more complicated than I expected, mainly due to the number of outdated howto’s out there. Anyway, here is how I moved my development over.

1. Install Xcode, X11 and X11SDK. Insert your Tiger DVD and install XCode, X11 and the X11SDK. They are on the first DVD (they came with your Mac), and this is as simple as finding the packages, double clicking on them and installing them. Easy.

2. Install SVN. You’re going to want to use Subversion to manage your code versioning. Download and install the client disk image here.

3. Install MacPorts. MacPorts used to be DarwinPorts, so they have a new name. Basically, just download a disk image and install. Once you install, update Macports by running:

sudo port -d selfupdate

Note: As of today there wasn’t a .dmg for DarwinPorts 1.3.2, so simply use the DarwinPorts 1.3.1 dmg.

4. Install Mysql (or whatever DB you use). I used the MacPorts version of Mysql4, so this howto will now branch into the MacPorts install. There are many ways to install Mysql (or Postgres, SQLLite, etc) on OS X, so you might wish to search around for options if so desired.

sudo port install mysql4 +server

5. Modify the system path. Add the following to /etc/profile. Once you’ve added, you will either need to “source /etc/profile” or exit and restart your terminal shell.


PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin :/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin"

6. Install Ruby/Gems/FCGI.

sudo port install rb-rubygems
sudo port install rb-fcgi

7. Install Rails/Rake.

sudo gem install rails
sudo gem install rake

8. Start MySQL. You’ll need to start up your Mysql server. The following command will do that (and set the socket).

sudo /opt/local/bin/mysqld_safe --user=mysql --socket=/tmp/mysql.sock

9. Transfer your Databases. You’ll also need to import your old databases over to your new machine. On your old computer:

sudo mysqldump -A > ~/Desktop/db.txt

Move this file over to your new computer. Import it on the new computer as follows:

sudo mysql -u root < db.txt

If you are installing Rails from scratch, with no experience, I would suggest that you look for more in-depth howto’s. The ones I used heavily in creating this are available here:

These are good resources, but the challenge is picking what approach you want to take, and knowing what is important for the install. In all of these, you can pick and choose your approach, which can lead to confusion for newbies. I’ve skirted this issue by just documenting my approach, with my preferences, but it still should be helpful for people who have a little rails experience and are moving to a new computer (lucky you).

Comments, suggestions, glaring errors – leave comments and I’ll update this doc.

Tags:

3 comments

  1. John Joseph Bachir

    Beware that the version of Ruby installed by MacPorts is 1.8.5, which breaks the Rails breakpointer.

    The Rails breakpointer depends on a bug which was fixed in 1.8.5, so kudos to the Ruby folks, but I’ll have to wait for a workaround or new implementation of the Rails breakpointer before I upgrade.

  2. Thank you JJB. Good points.

  3. RubyCocoa is the bomb

Leave a comment