Raven’s new Site Performance tool instantly collects 30+ metrics for any website. Then, you can… well, find out.

Ruby on Rails with OS X Tiger

Raven

Ruby on Rails with OS X Tiger

I’ll admit there are already 12 million documents out there claiming to explain this, but for one reason or another I couldn’t get any of them to work as written. Ruby on Rails is undergoing rapid development, and OS X is not sitting still either. Here are the steps I used, which should continue to be relevant since I am installing from source instead of relying on the ruby package that comes with Tiger.

1. Install Xcode Tools

Insert your Mac OS X Install Disc 1. Find the Xcode Tools directory, in there you’ll find XcodeTools.mpkg. Double-click it.

2. Install MySQL.

http://dev.mysql.com/downloads/mysql/4.1.html

I installed Mac OS X 10.4 (x86) Standard 4.1.19, you can install whatever you want.

3. Install ruby

http://www.ruby-lang.org/en/downloads/

cd ruby-1.8.4
./configure
make -j5
sudo make install

4. Fix your PATH.

Add this line to ~/.profile

export PATH=/usr/local/bin:/usr/local/mysql/bin:${PATH}

Close and reopen your terminal window, and make sure it worked by running this:

echo $PATH
/usr/local/bin:/usr/local/mysql/bin:/bin:/sbin:/usr/bin:/usr/sbin

5. Make sure you have the right version of ruby

which ruby
/usr/local/bin/ruby

ruby -v
ruby 1.8.4 (2005-12-24) [i686-darwin8.6.1]

6. Install Ruby Gems

http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar xzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
sudo ruby setup.rb

7. Install Rails

sudo gem install rails --include-dependencies

8. Install MySQL drivers

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql/

Pick this option:
3. mysql 2.7 (ruby)

9. Create a new Rails application

cd ~/Sites
rails myapplication
sudo chgrp -R www myapplication/tmp
sudo chmod -R g+w myapplication/tmp

10. Configure Apache:

sudo vi /private/etc/httpd/users/yourusername.conf

NameVirtualHost *:80

<VirtualHost *>
ServerName myapplication
DocumentRoot /Users/yourusername/Sites/myapplication/public
<Directory /Users/yourusername/Sites/myapplication/public>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

sudo chmod 755 ~/

sudo apachectl restart

11. Edit /etc/hosts

sudo vi /etc/hosts

127.0.0.1 myapplication

Your done! With any luck, you should be able to visit http://myapplication/ with your browser and see the Welcome Aboard message from Rails. Error messages and debugging information will be in ~/Sites/myapplication/log/development.log.

Thanks to Saari Development for this post, which helped me put some of these pieces together.

Tell us what you think

  • http://www.lightning-alley.com Richard Jones

    Good article, I just picked up a MBP a couple of days ago and Rub on Rails is actually one of my first projects I want to pursue. This will definitely come in handy, Thanks!!!

  • http://www.sitening.com/ Jon Henshaw

    Worked perfectly for me. Thanks Scott!

  • Felix

    Thanks! this guide helped me get started fast.

    On step 11, you might want to set your home directory’s permissions to 711 if you want to keep other users from listing (and possibly reading) your home’s contents.

    Cheers!

  • webb

    Great job guys… Thank for you work…

  • saman

    Thanks, it worked great! Much appreciated!

    I couldn’t the MySQL drivers to install, but that’s no biggie – I from what I read somewhere they’re only a 15 percent performance improvement, which I won’t be noticing during development. I’ll figure it out later (famous last words).

    One suggestion is for step 6 to be:
    sudo ruby setup.rb all –prefix=/usr/local

    That’ll make sure that gems is installed in /usr/local/bin, together with the good ruby (rather than /usr/bin with all messed up apple ruby stuff.)