Today is Leopard day!
Posted by David October 26, 2007 @ 08:46 PM
OS X 10.5 is shipping today under the Leopard moniker. Besides being a great upgrade to a wonderful operating system, it's also the first version of OS X that ships with Rails in the package. Apple has done a phenomenal job including all the good stuff from the Ruby and Rails world into the developer tools that come with the OS.
So out of the box you get Ruby 1.8.6, Rails 1.2.3 (which is just a "gem update rails" call away from being 1.2.5), Capistrano, SQLite-bindings, and so much more. No more need for compiling your own Ruby. It's great. See all the changes in What's New in Leopard.
The only minor snag is that in order to install the MySQL C bindings for Ruby, you have to be quite particular on the command line. Here's the cheat line you need to install (read more at macosforge):
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
So happy Leopard day, folks!

Fanboys!
Can we get the tutorials in mp4 or mpeg format?
Still having weird issues:
$ irb -rrubygems -rmysql /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib (LoadError) Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle Reason: image not found – /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `require’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:253:in `load_modules’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in `each’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in `load_modules’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:21:in `setup’ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:54:in `start’ from /usr/bin/irb:13
I updated the instructions in http://trac.macosforge.org/projects/ruby/wiki/Troubleshooting#IcannotbuildrubymysqlonLeopardwithmysql.combinaries . Please give it a try. It is still unclear why Tiger is not affected, we will investigate more and post updates in the wiki page.
Linux FTW
thanks lrz,that’s ok
Apple/Mac sucks
It’s easy to hate chocolate when all you’ve eaten is carob chips
Kevin: I’ve had that error too, even on Tiger. I was able to fix it with the following commands:
cd /usr/local/mysql/lib sudo mkdir mysql cd mysql sudo ln -s /usr/local/mysql/lib/lib* .
Good luck! :)
There is a problem with “gem update—system” in leopard, if you do that, all the previously installed gem disappear. Probably this is something related to ENV path or similar. In any case my gem installation is just blow up.
Very bad.
Works like a charm, thanks for the valuable info!
I’ve had the same issue as stid. I did a gem update—system, and gleefully watched it work it’s magic. Then i went to try and install a new rails app and it gave me an error. The issue is there are two gem repos in Leopard the one under /System/Frameworks/Ruby* and the user one (in your home /Library folder). I think to fix it you need to add the System repo back into the gem_path using an env variable??
I have an apple discussion open for it here: http://discussions.apple.com/click.jspa?searchID=-1&messageID=5668663
You may need to install XCode on top of Leopard to get the mysql-ruby bridge. I ran into a ‘could not find ruby headers’ error and installing XCode solved my problems.
I went the Mac Ports route.
Something about messing around in /usr/bin and /usr/lib gave me the heebie-jeebies. (This may be n00b superstition.)
In any case, there were some issues with compiling Ruby on Leopard, but the patches provided by Apple appear to have made their way into MacPorts. Worked without a hitch for me!
That said, good on Apple for making Rails a first-class citizen in the new OS. :)
java was a first class citizen as well, so don’t count too much on that…
If you did a gem update—system command you’ll probably find yourself up the creek with no paddles. The problem is the paths to the two repos get messed up when you update rubygems. To fix you can add the paths to your .profile and also add a ~/.MacOSX/environment.plist file to fix it for the MacOS login session. See the links below for details:
http://discussions.apple.com/thread.jspa?threadID=1200950&tstart=0
http://discussions.apple.com/thread.jspa?threadID=1202925&tstart=0
Travel to Vietnam
Specializing in custom-made Vietnam tours & Vietnam travel. We shall endeavor to make your Vietnam holiday a memorable one. Good quality and competitive prices is our motto, Join us and find out for yourself. We’ll respond within 24 hours! Please visit our site: http://www.vietnam-travelinfo.com Vietnam travel tours holiday operator
We received many questions, and decided to open a FAQ. Please check it out:
http://trac.macosforge.org/projects/ruby/wiki/FAQ
dumb question, but how do I build a new application in Leopard? Can I use xCode, Coda?
The comments above are the main reason I’m not rushing to Leopard.
Thanks for this David, saved a lot of time playing with compile settings.
Apple made a very stupid decision to exlude gem_server from embeded Ruby in Leopard. I had to remove this stupid Ruby installation and replace it with MacPorts’s version.
Hey folks,
I just noticed that the MySQL package downloads now include a universal binary for Mac OS X. Does this mean the above install note can be ignored and just use the standard gem install when using the universal build of MySQL?
Wait, Sorry I just realized that it is a tar package that has a universal binary so ignore my last comment. I’d prefer just using the package format and using the posted install note.
Is MacPorts safe on Leopard even though it doesn’t seem to have updated yet for it? I’m trying to figure out the best way to install mysql.
Migrating MySQL 5.0.45 to Mac OS X 10.5 Leopard http://blog.tomatocheese.com/archives/2007/11/1/migrating_mysql_to_mac_os_x_leopard/
and fanbois sucks even more
Why do so many people seem to depend on MacPorts for installation issue involving Ruby, MySQL, etc?
Ruby compiled fine on Tiger and it should compile fine in Leopard. You don’t really need to “mess around” in /usr/bin. Make a directory in /usr/local to hold the src.
Dan Benjamin’s step-by-step should work fine for Leopard. http://hivelogic.com/narrative/articles/ruby-rails-mongrel-mysql-osx
As far as MySQL, there are usually MySQL binaries for OS X.
Hmm… I’m still not convinced about moving to Ruby on Rails from Java.
Is it worth it?
Morten: before you should for example consider wicket (now even under apache.org)
http://wicket.apache.org
Especially I don’t like refactor support in ruby (if there is one?!)
e.g., rename your controller from ‘UserController’ to ‘UsersController’, then have a dozen unit tests fail and change a 20-30 files manually (this really sucks bad :-)
Also, java has about any 3rd party support library you could think about
I am on leopard, but was one of the idiots who had FileVault on while upgrading, so ended up having to start from scratch. Since I now have ruby and rails and everything already installed, why would I have to install anything? Except mysql, that doesn’t seem to be there. Can anybody tell me how to do that? I don’t really understand this paths business and don’t want to dabble too much. Or where can I find out how to go about it? Thanks
I did the gem update—system as well, but I used Timemachine to roll my /Library/Ruby folder back and now I am fine.
Don’t do gem update—system.
Having problems with Ruby and Mac OS X ? Sounds familiar. Gentoo is the answer – enormous flexibility, control and stability – you’ll never look back.
“Having problems with Ruby and Mac OS X ? Sounds familiar. Gentoo is the answer – enormous flexibility, control and stability – you’ll never look back.”
If you are not able to do the trick explained in this article, don’t hope to be able to solve any problems with Rails even on a Gentoo.
The problem is not the OS, it’s you …
PS: anyway, I would much prefer to use Solaris instead of Linux
this is how i install mysql whenever i need to, lots of info, and dead simple.
http://www.entropy.ch/software/macosx/mysql/
and personally, who cares what the hell we all use, as long as we make working apps right?? i really couldn’t care less. and since this was an entry on leopard, if you hate mac so much, why bother reading it?
which version of mysql did people who got it installed successfully who also followed this recomendation use for lepoard? It gives the options to choose: mysql 2.7.3 (mswin32) mysqo2.7.1 (mswin32) mysql 2.7 (ruby) mysql 2.6 (ruby)
@Morten: Why don’t you go step by step – move to Grails first?