An Even Better Way to Build Ruby, Rails, Lighttpd, and MySQL on Tiger 16 comments

posted Thursday, December 29, 2005 by topfunky

UPDATE Now uses Ruby 1.8.5 and Mongrel. Is stored in SVN for easier updating.

In an attempt to regain my postition from Mr. Benjamin in these Google searches I have put together a single script that does everything he mentions in this article.

Download Ruby Rails Mongrel MySQL Script for Mac OS X PPC

Download Ruby Rails Mongrel MySQL Script for Intel Macs

Set the PATH in your shell of choice

Bash (.bash_login)
export PATH="/usr/local/bin:/usr/local/sbin:$PATH" 
Tcsh (.cshrc)
setenv PATH ${PATH}:/usr/local/bin:/usr/local/sbin

Download and Run ru-ra-lim.sh

sh ru-ra-lim.sh

It will take a while, and will ask you for your password a few times. However, rest easy in the knowledge that everything is being done automatically for you!

At the end, it will open the MySQL package. Install all the items there.

Finally, Install the MySQL Gem

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

I used this on my laptop and it worked smoothly. Feedback appreciated (although commenting here is borked for Firefox 1.5 and maybe others…).

Oh, Yeah…

And Dan? I dare you to beat me in this search!

16 comments

Leave a response

  • Dan Benjamin

    Hey, nice work here! Very handy.

  • Thanks Geoff, just what the doctor ordered.

    One thing though… running ./script/server still runs Webrick, I thought the latest Rails was supposed to use Lighttpd if it’s installed?

  • Blaine

    Not sure why this syntax:

    sudo gem install mysql——with-mysql-dir=/usr/local/mysql

    is preferred over this one:

    sudo gem install mysql——with-mysql-config=/usr/local/mysql/bin/mysql_config

    since the latter will always provide all the right configuration options, including (but not limited to) the path to the installation.

    I also have a script that will install ImageMagick / RMagick for Gruff without darwinports / fink. Hmm, which reminds me, I need to send you some screenshots. ;-)

  • topfunky

    Jamie—

    If ./script/server still runs webrick, try the following

    1. Type ‘lighttpd’ at the command line. If it doesn’t find the command, you need to make sure that you added /usr/local/bin (and sbin) to your PATH. Close your Terminal window and open a new one to reload those settings.
    2. Make sure you have a recent version of Rails. Try ./script/about or ‘rails -v’ and look for a version greater than 0.14.0 (it sounds like you did this).
    3. See if Rails copied a lighttpd.conf file into your ./config folder. If not, try one of the previous points, or make your own.

  • Jamie Hill

    Thanks, in the end I entered the following as lighttpd is sitting in /usr/local/sbin

    echo “export PATH=/usr/local/sbin:$PATH” >> ~/.bash_profile

    Maybe the install path should be set in the shell script?

  • Brian

    I am new to both RoR and OS X. Gave the script a shot and got the following on installing the MySQL Gem. Any thoughts? Thanks.

    TM5:~/Desktop brian$ sudo gem install mysql——with-mysql-dir=/usr/local/mysqlAttempting local installation of ‘mysql’ Local gem file not found: mysql*.gem Attempting remote installation of ‘mysql’ Building native extensions. This could take a while… ERROR: While executing gem … (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/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… yes checking for mysql_query() in -lmysqlclient… no checking for main() in -lz… yes 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/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

  • devlogic

    Can’t take credit for it myself, but I found (via multiple links, now too buried in my FF history file to find) this link that seemed to do the trick for me: http://groups.google.com/group/comp.lang.ruby/msg/5b7d897c4316a6d0

  • sc

    What’s the reasoning behing installing both ruby-fcgi from source AND via gems? Only one of those two methods are needed.

  • Wow that’s awesome! It’s much easier than doing all of that manually. Thanks!

  • johnny

    i haven’t seen any information regarding why the latest version of ruby, readline, gems and mysql are not being used. are the current stable versions ‘unstable’ in OS X?

    johnny.sainz@gmail.com

  • lance303

    After using the hivelogic instructions on two machines in past couple days, I was thinking about making a script as well, but I was too lazy…

  • Tao

    My RoR install worked OK, but I wasn’t able to get Lighttpd+FCGI to work before.

    So I ran the script.

    Now all Ruby scripts (incl. server and about) give me the following error: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__’: No such file to load—initializer (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require’ from ./script/../config/boot.rb:16 from ./script/about:2:in `require’ from ./script/about:2

    It seems to refer to a require of “initializer”. No idea where to get that. Any body here know?

    Thanks!

  • Blain said: “I also have a script that will install ImageMagick / RMagick for Gruff without darwinports / fink. Hmm, which reminds me, I need to send you some screenshots. ;-)”

    Can you put that script up somewhere please? i would really appreciate it. I hate installing image/Rmagick on osx.

    Thanks

  • Curl was broken on my install of Tiger (10.4.3 with updates on a brand-new Powerbook)—downloads would never stop, even after reaching one hundred percent.

    The fix was easy: I updated Curl to 7.15.1 and installed it as instructed. Works great now!

    Thanks for the great install script, Geoffrey!

  • Kamal

    ru-ra done manually with trivial changes completed successfully for me (under OSX 10.4.3 Xcode 2.2). But in trying to use gem as a non-root user, I get errors similar to what Tao reported:

    mir% sudo gem -v Password:xxxxxx 0.8.11

    mir% gem -v /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__’: no such file to load—stringio (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’ from /usr/local/lib/ruby/1.8/yaml.rb:9 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:6 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:61:in `manage_gems’ from /usr/local/bin/gem:4

  • Bora Turan

    I am still having the same problem, that I have got while doing the same thing manually. localhost:3000 works properly but when I create an application, it gives the problem.

    Does anybody know how to sort this out;

    dyld: NSLinkModule() error dyld: Symbol not found: _rl_completion_matches Referenced from: /usr/local/lib/ruby/1.8/powerpc-darwin8.5.0/readline.bundle Expected in: flat namespace

    Trace/BPT trap

    Thank you in advance

Your Comment

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Manufactured with

Subscribe

Subscribe (RSS)