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!

This entry was posted in Desktop, OSX, Ruby, Software Engineering. Bookmark the permalink.

26 Responses to Ruby on Rails Mac OS X Intel Binary

  1. Chuck Cheeze says:

    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

  2. Chuck Cheeze says:

    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…

  3. Todd Huss says:

    Yup, you should be all set since you built from source!

  4. topfunky says:

    Nice.

    I’m reorganizing my site and will link to your updated script.

  5. durain says:

    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

  6. Todd Huss says:

    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”

  7. durain says:

    Thanks Todd,

    Got it working once I got the Xcode Tools installed. I am a newbie, so please bare with me.

    Thanks.

  8. chao lam says:

    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

  9. Duncan McGregor says:

    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

  10. Duncan McGregor says:

    Ooops, can’t paste sensibly into a small window!

  11. Todd Huss says:

    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.

  12. Duncan McGregor says:

    The business, thanks.

  13. Bakki Kudva says:

    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

  14. Todd Huss says:

    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 .

  15. Jeff Mills says:

    Just installed, worked like a charm, many thanks.

  16. judy engelsberg says:

    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.

  17. judy engelsberg says:

    Apple support fixed problem. Getting ready right now to enjoy your great installer. Thanks.

  18. Pingback: zak.thoughts.persist() » Blog Archive » Setting up Intel Mac for Rails development

  19. sergio says:

    Thank you so much for your installer. I tried so many dfferent tutorials and nothing worked but yours worked perfectly.

    thanks again

  20. Noel Jackson says:

    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

  21. Ryan M says:

    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

  22. Bob Silva says:

    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.

  23. Sven says:

    Are you still maintaining these great packages. I’m asking as Rails 1.2 is out now.

  24. Todd Huss says:

    Sven, you can download the current version and then just run a “sudo gem update” which will install Rails 1.2.

  25. chao lam says:

    Todd: Thank you for this package. I’ve been using this for 2 years now! Is there an easy to upgrade my current installation to ruby 1.8.6?

Leave a Reply

Your email address will not be published. Required fields are marked *