Ruby on Rails Mac OS X Intel Binary
Update 8/13/06: Upgraded to Rails 1.1.6
Update 5/10/06: Upgraded to Rails 1.1.2 and built Ruby with the ri docs per Duncan McGregor’s comment
Update 4/7/06: Upgraded to Rails 1.1.1
Update 3/28/06: Now that Rails 1.1 has arrived I’ve upgraded this package to include it.
Here are the Installation Instructions and here is the all-inclusive ~9MB file to download: RubyOnRailsMacIntel-1.1.6.tar.bz2. If you would prefer to build from source here is my updated version of Geoffrey’s do it all ru-ra-lim.sh script that now works on Mac Intel too.
I’ve created a Mac Intel binary distribution of Ruby on Rails with Lighttpd based on the work of Geoffrey and Dan. It includes:
Ruby 1.8.4, Readline 5.0, RubyGems 0.8.11, Rails 1.1.2, FastCGI 2.4.0, RubyFastCGIBindings 0.8.6, PCRE 6.6, and Lighttpd 1.4.11.
I did not include MySQL because I didn’t want to presume if you prefer MySQL 5 or 4.1 and MySQL offers Intel binaries for the Mac.
I created this binary distribution for 3 reasons:
1. I don’t believe your average user should be required to build from source to get up and running.
2. The previous mentioned solutions installed into /usr/local/. I prefer to install in a dedicated application directory I can simply delete when I want to uninstall. So I’ve got it all going under /usr/local/ror. Want to uninstall? Just delete /usr/local/ror.
3. I couldn’t find a Mac OSX Intel binary of Ruby on Rails with Lighty anywhere.
Let me know if you find this useful or if you have problems!
March 26th, 2006 at 12:04 am
Hey Todd, looks great. I already installed everything on my iMac Intel according to Dan’s instructions with no problems. It works great. Most everything on my iMac is already UB…great…but I didn’t realize Ruby and such needed to be as well, and hadn’t seen official announcements that any new versions were out as UB. So can you help me explain how you have a UB distribution? And if Dan’s is working great on mine, should I install yours? Should (and how do) I uninstall his?
Secondarily. I am getting along well using Rails, and kind of got tired of looking all over my Delicious, Bookmarks, etc for links to tutorials and references, so I built a site that I am hoping will be useful to a lot of Rails programmers. Its my link above, so feel free to check it out. Forum, links page, etc. I hadn’t seen a forum yet dedicated to Rails with indivdual breakouts of different aspects of the framework. Thanks Chad
March 26th, 2006 at 8:31 am
OK I am a dork…partly due to the time of my post, partly being a Mac noob…once I shut down for the night and was brushing my teeth it occured to me that I built Ruby et. al. from the source, and didn’t install it with a binary, so I am good to go. Really, I am smarter than this…
March 26th, 2006 at 9:28 am
Yup, you should be all set since you built from source!
March 28th, 2006 at 11:11 am
Nice.
I’m reorganizing my site and will link to your updated script.
March 29th, 2006 at 12:33 pm
Tried to run “sudo gem install mysql — –with-mysql-dir=/usr/local/mysql”
and get the following error:
Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Building native extensions. This could take a while…
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/local/ror/bin/ruby
–with-mysql-config
–without-mysql-config
–with-mysql-dir
–with-mysql-include
–without-mysql-include=${mysql-dir}/include
–with-mysql-lib
–without-mysql-lib=${mysql-dir}/lib
–with-mysqlclientlib
–without-mysqlclientlib
–with-mlib
–without-mlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-zlib
–without-zlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-socketlib
–without-socketlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-nsllib
–without-nsllib
–with-mysqlclientlib
–without-mysqlclientlib
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/local/ror/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
ruby extconf.rb install mysql — –with-mysql-dir=/usr/local/mysql\nchecking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… no
checking for mysql_query() in -lmysqlclient… no
Results logged to /usr/local/ror/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
Any ideas? Thanks
March 29th, 2006 at 2:03 pm
Hi Durain, thanks for trying it out! A couple of things to check:
1. Make sure you have XCode installed by running ‘gcc –version’ should show GCC version 4.0.1 or similar.
2. Make sure the correct version of ruby is in your path `which ruby` should show /usr/local/ror/bin/ruby and NOT /usr/bin/ruby
3. Make sure MySQL is installed in /usr/local/mysql, for example `which mysql` should show /usr/loca/mysql/bin/mysql
4. Make sure MySQL header files in your installation by running: find /usr/local/mysql* -name “mysql.h”
March 29th, 2006 at 3:26 pm
Thanks Todd,
Got it working once I got the Xcode Tools installed. I am a newbie, so please bare with me.
Thanks.
April 27th, 2006 at 3:37 pm
Hi Todd,
Thanks for a really nice package. Just a tiny correction. Step 3 of the readme should read:
3. Add the following to your .bash_login:
export MANPATH=/usr/local/ror/man:$MANPATH
export PATH=/usr/local/ror/bin:/usr/local/ror/sbin:$PATH
[Note sbin instead of bin for second path of $PATH]
Thanks again,
chao
May 8th, 2006 at 9:28 am
Hi, thanks for this great timesaver.
Any tips on how to get ri to function correctly? At present I get
”
$ which ri
/usr/local/ror/bin/ri
$ ri
No ri documentation found in:
Was rdoc run to create documentation?
…
$ which ri
/usr/local/ror/bin/ri
~
$ ri
No ri documentation found in:
Was rdoc run to create documentation?
$ which ri
/usr/local/ror/bin/ri
~
$ ri
No ri documentation found in:
Was rdoc run to create documentation?
…
_If you installed Ruby from a binary distribution_ (perhaps using a
one-click installer, or using some other packaging system), then the
team that produced the package probably forgot to package the
documentation as well. Contact them, and see if they can add it to the
next release.
”
Thanks in anticipation
Duncan
May 8th, 2006 at 9:29 am
Ooops, can’t paste sensibly into a small window!
May 10th, 2006 at 9:39 am
Should be all set now Duncan, you’ll need to download the latest archive though. I added this feature to the ru-ra-lim.sh script I use to build from source so it should be in there for this one as well as future releases.
May 10th, 2006 at 1:18 pm
The business, thanks.
May 11th, 2006 at 12:11 pm
Is it required that you change all the shebang lines in scripts generated to /usr/local/ror/bin? I thought this was a drag with the Darwinports since everything is at /opt/local.
How are you managing this? You have to change everything back when you deploy your app to an ISP right?
Thanks,
bakki
May 11th, 2006 at 5:49 pm
Bakki, there are two approaches to this.
1. If you’re creating new scripts you should use
#!/usr/bin/env ruby
2. If you have a bunch of legacy scripts you don’t want to change you can symlink ruby into /usr/local so you don’t need to update the path to ruby:
cd /usr/local/bin
ln -s /usr/local/ror/bin/ruby .
June 9th, 2006 at 7:20 pm
Just installed, worked like a charm, many thanks.
June 15th, 2006 at 5:20 am
Thanks for your installer. According to your directions, I tried installing mySQL 4.1 standard first. Running os 10.4.6 on brand new intel iMac. Installer doesn’t recognize the hard drive. There are NO DESTINATIONS to install! Any work-around for this? Thanks for any help. I REALLY appreciate that you made an installer for Ruby on Rails.
June 15th, 2006 at 8:30 am
Apple support fixed problem. Getting ready right now to enjoy your great installer. Thanks.
June 16th, 2006 at 1:31 pm
[…] After googling around for a few hours and trying different RoR packagers, I found a nice, non-intrusive Mac Intel package at Todd Huss’s blog. Unlike Locomotive, which is a PowerPC application that hides the underlying Rails infrastructure, Todd’s package gives you a simple directory structure with Ruby and the basic gems that you can drop anywhere on your filesystem. […]
July 3rd, 2006 at 10:06 pm
Thank you so much for your installer. I tried so many dfferent tutorials and nothing worked but yours worked perfectly.
thanks again
August 29th, 2006 at 3:14 pm
Seems that the URL for the Ruby 1.8.4.tar.gz file is wrong; it should be http://rubyforge.org/frs/download.php/7858/ruby-1.8.4.tar.gz
September 1st, 2006 at 5:05 pm
Todd - this is very useful. Thanks. One thing though … I followed your instructions for installing the mysql driver, but based on the output, I’m not sure if it worked on not. Here’s what happened:
RM-MacBookPro:~ ryan$ sudo gem install mysql — –with-mysql-dir=/usr/local/mysql
Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Select which gem to install for your platform (i686-darwin8.5.2)
1. mysql 2.7.1 (mswin32)
2. mysql 2.7 (ruby)
3. mysql 2.6 (ruby)
4. mysql 2.5.1 (ruby)
5. Cancel installation
> 2
Building native extensions. This could take a while…
mysql.c: In function ‘Init_mysql’:
mysql.c:2015: error: ‘ulong’ undeclared (first use in this function)
mysql.c:2015: error: (Each undeclared identifier is reported only once
mysql.c:2015: error: for each function it appears in.)
mysql.c:2015: error: parse error before numeric constant
mysql.c:2018: error: parse error before numeric constant
make: *** [mysql.o] Error 1
mysql.c: In function ‘Init_mysql’:
mysql.c:2015: error: ‘ulong’ undeclared (first use in this function)
mysql.c:2015: error: (Each undeclared identifier is reported only once
mysql.c:2015: error: for each function it appears in.)
mysql.c:2015: error: parse error before numeric constant
mysql.c:2018: error: parse error before numeric constant
make: *** [mysql.o] Error 1
ruby extconf.rb install mysql — –with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… yes
checking for mysql_ssl_set()… yes
checking for mysql.h… yes
creating Makefile
make
gcc -fno-common -g -O2 -pipe -fno-common -I. -I/usr/local/ror/lib/ruby/1.8/i686-darwin8.5.2 -I/usr/local/ror/lib/ruby/1.8/i686-darwin8.5.2 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/local/mysql/include -c mysql.c
make install
gcc -fno-common -g -O2 -pipe -fno-common -I. -I/usr/local/ror/lib/ruby/1.8/i686-darwin8.5.2 -I/usr/local/ror/lib/ruby/1.8/i686-darwin8.5.2 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/local/mysql/include -c mysql.c
Successfully installed mysql-2.7
Note that the last line said it successfully installed but yet there seems to be compiler error above. Should I be concerned about this?
I’m running mysql v 5.0.24a (universal).
Thanks again.
Ryan
September 12th, 2006 at 10:16 am
This seems to be a problem with the mysql gem and the latest MySQL for OS X. I get the same error and am trying to figure it out, when I do I’ll post back.
September 12th, 2006 at 10:54 am
A fix for compiling the ruby mysql gem on OS X with mysql 5.0.24+.
http://i.nfectio.us/articles/2006/09/12/running-rails-on-os-x-with-mysql-5-0-24
February 2nd, 2007 at 11:08 am
Are you still maintaining these great packages. I’m asking as Rails 1.2 is out now.
February 2nd, 2007 at 11:58 am
Sven, you can download the current version and then just run a “sudo gem update” which will install Rails 1.2.