Installing Ruby on Rails on Tiger
This article is now out of date, and has been supplanted by a newer version, located here.
Many readers have written-in requesting instructions for manual installation of Ruby, Ruby on Rails, FastCGI, and Apache on Mac OS X 10.4 (Tiger).
Rather than making readers wait for the release of these instructions until a time when you can fully flesh them out with commentary, you have decided to release them immediately, sans-annotation and with apologies for the lack thereof.
Starting Out
It’s best to compile in a src file of some kind. It doesn’t really matter where this folder is, it could be one’s Desktop, or /usr/local/src for example. All operations should take place there. You’d start like this:
mkdir ~/Desktop/src cd ~/Desktop/src
You’ll download to and compile everything from right there.
System Prerequisites
You might want to have Xcode 2.1 or newer installed. It contains a few updates to the stock Tiger Xcode (2.0) that can make for better executables, like a newer version of Apple’s cctools.
Paths
Once again, be sure that your path precedence is for /usr/local/bin before /usr/bin or else things won’t work correctly. This can be accomplished with the following lines in a file called .bash_login in your home directory:
PATH="/usr/local/bin:/usr/local/sbin:$PATH" export PATH
Be sure to close Terminal and open a new one prior to running the commands below.
Warning
Do this stuff at your own risk. The Narrator won’t take any responsibility if you break your system, cross the streams, or initiate the apocalypse.
Ruby Stuff
First we install Readline, a prerequisite for Ruby.
curl -O ftp://ftp.gnu.org/gnu/readline/readline-5.0.tar.gz tar xzvf readline-5.0.tar.gz cd readline-5.0 ./configure --prefix=/usr/local sed -e 's/-dynamic/-dynamiclib/' shlib/Makefile > shlib/Makefile.new mv shlib/Makefile.new shlib/Makefile make sudo make install cd ..
Next up, Ruby.
curl -O ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz tar xzvf ruby-1.8.2.tar.gz cd ruby-1.8.2 ./configure --prefix=/usr/local --with-readline-dir=/usr/local make sudo make install cd ..
RubyGems is next.
curl -O http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgz tar xzvf rubygems-0.8.10.tgz cd rubygems-0.8.10 sudo ruby setup.rb cd ..
With Gems installed, we can get Rails.
sudo gem install rails --include-dependencies
FastCGI is next.
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz tar xzvf fcgi-2.4.0.tar.gz cd fcgi-2.4.0 ./configure --prefix=/usr/local make sudo make install cd ..
Next up, Ruby-FastCGI bindings
curl -O http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz tar xzvf ruby-fcgi-0.8.6.tar.gz cd ruby-fcgi-0.8.6 /usr/local/bin/ruby install.rb config --prefix=/usr/local ruby install.rb setup sudo ruby install.rb install
Next, the Ruby-FCGI Gem.
sudo gem install fcgi
Apache Stuff
Mod-FastCGI is first.
curl -O http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz tar xzvf mod_fastcgi-2.4.2.tar.gz cd mod_fastcgi-2.4.2 apxs -o mod_fastcgi.so -c *.c sudo apxs -i -a -n fastcgi mod_fastcgi.so cd ..
Add this to /etc/httpd/httpd.conf at the end of the file. BBEdit works well for this, and handles authentication for you (bbedit /etc/httpd/httpd.conf from the command line). Feel free to change the port (from 3000) to a port of your choice.
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>
<p>Listen 80
Listen 3000
&lt;VirtualHost *:3000&gt;</p>
DocumentRoot /path/to/my/rails/app/public/
&lt;Directory /path/to/my/rails/app/public/&gt;
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Allow from all
Order allow,deny
&lt;/Directory&gt;
&lt;/VirtualHost&gt;
Restart apache (using sudo apachectl restart) to get the changes.
Done.
