So Rails is already installed on Leopard but you'll probably want to update it to the latest version. So first you need to install the make tools from your Leopard disc:
Leopard CD > Optional Installs > Xcode Tools > XcodeTools.mpkg
Update Rails and all the other gems:
sudo gem update --include-dependencies
Now for mysql. You can download a pre-built package from their site http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg
Note that you don't have to register - you can skip past it using the link after the form.
The start up package doesn't work (at the time of writing). However, I found a work around. I'll include the instructions here as well:
First download this MySQL launchd configuration file
sudo mv Downloads/com.mysql.mysqld.plist /Library/LaunchDaemons/
sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chown -R mysql /usr/local/mysql-5.0.51a-osx10.5-x86/ /usr/local/mysql
sudo launchctl load /Library/LaunchDaemons/com.mysql.mysqld.plist
To allow you to just type 'mysql' from the command line:
vi ~/.bash_profile
Enter the following into the file
export PATH="$PATH:/usr/local/mysql/bin"
Restart terminal and mysql is all setup and will start every time you reboot.
DHH recommends you install the mysql C bindings like thus:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Job done!
Leopard comes with mongrel and svn and lots of other goodies out of the box! Have a look with:
gem list
About Paul
Paul works for Kyan web design agency in Surrey, UK as a Ruby on Rails developer.
Follow Paul on Twitter
Email: paulsturgess [at] gmail.com
Comments...
I seem to be getting the following error when i try to install the C bindings :S
I installed the 64bit version (both the package and the startup item) and changed one of the paths in the commands you mentioned to accommodate this. Everything has worked except this command :((
Scotty at 14 Apr 08 at 05:41
It ran fine for me.
Here's a <a href="http://trac.macosforge.org/projects/ruby/wiki/Troubleshooting#IcannotbuildrubymysqlonLeopardwithmysql.combinaries">full explanation</a> of the that line. If it helps?
Paul at 14 Apr 08 at 05:51
Thanks, Paul! Turns out it was just a proxy/firewall issue. I've just got back home and run the script once more - works perfect now :)
Cheers!
Scotty at 14 Apr 08 at 11:21
Thanks for the tips, however there should be a word of caution as the above methods will lead to an "edge" installation of rails (I got version 2.0.2.9216) which caused a lot of incompatibility grief. In that event, I had to extirpate 2.0.2.9216 and install instead, rails 2.0.2 the stable version. Keep it up!
kuang at 02 May 08 at 23:35
Strange... when I did it I just got version 2.0.2
Paul Sturgess at 03 May 08 at 03:12
Probably 2.0.2 was the "edge" version at that point in time at the repository when you wrote the script.
kuang at 03 May 08 at 06:45
I just ran 'gem update --include-dependencies' again and Rails was not updated to the edge release. My version remained at 2.0.2
I always understood that the
gems system was for public releases.
Paul Sturgess at 03 May 08 at 07:27
Hi Paul,
We might be both right :-) It may be at some stage in the recent past gem was problematic and was dishing out 2.0.2.9216 instead?
See "here":http://hobocentral.net/forum/viewtopic.php?t=4127 and "here":http://www.ruby-forum.com/topic/151093
Also google "gem problem 2.0.2.9216" to see fallout.
The important thing is to verify the gem list using:
gem list --localIf someone have rails 2.02.9216 and not wanting to run "edge" then recovery via something like terminal session below:
kuang at 03 May 08 at 23:38
That would explain it!
Thanks for clearing that up kuang. Appreciate it.
Paul Sturgess at 04 May 08 at 04:17
Hey mate,
Just to let you know that the MySQL package i downloaded was in fact:
mysql-5.0.51b-osx10.5-x86
and not...
mysql-5.0.51a-osx10.5-x86
This stumped me for a few minutes when trying to run:
sudo chown -R mysql /usr/local/mysql-5.0.51a-osx10.5-x86/ /usr/local/mysql
Perhaps something for other people to look out for.
Peter Roome at 13 May 08 at 18:23
Hi Paul
when i write
$ sudo gem update
i see this error message:
<quote>
Updating installed gems
Updating actionmailer
ERROR: While executing gem ... (Gem::InstallError)
invalid gem format for /Library/Ruby/Gems/1.8/cache/activesupport-2.1.0.gem
</quote>
how can i solve this problem?
Mr.Jar at 30 Jun 08 at 16:10
Nice write up, worked like a charm!
Irish at 30 Jun 08 at 22:31
How do I setup up Apache so that I can use Leopard (not Leopard server)as my production machine.
Thanks.
Dave at 08 Jul 08 at 14:52
Totally helpful post.
Thanks Paul!
Yongkun Jeon at 15 Jul 08 at 05:43
Thanks for the steps, very helpful. However, I get an access denied when trying to follow some of the steps -- do we have to enable the root user and log in as root first?
Ben Strackany at 17 Oct 08 at 12:42
Ah never mind, I overlooked the "sudo" :)
Ben Strackany at 17 Oct 08 at 12:44
I LOVE YOU!!!! THANK YOU OH SO MUCH!!!
Christian Sueiras at 28 Nov 08 at 21:43
Hi,
I followed the steps that u did, except for the mysql I used the .dmg file to install the 32-bit version of mysql. but whenever I try to use the "rake db:migrate" command, I get the following error:
uninitialized constant MysqlCompat::MysqlRes
(See full trace by running task with --trace)
How can I solve this problem??
Ahmed Mostafa at 11 Jul 10 at 07:24
Got something to say?