Tuesday, January 31, 2006

Ruby on Rails on OS X

I was having the worst time getting my Rails applications to work from my Mac G5; they'd work fine from our Linux boxen. I kept getting this error when trying to do "script/generate" from my G5 (running OS X 10.4 Tiger) and connecting to our database server (a Linux box):


Access denied for user ''@'my.domain.name' (using password: NO)

think it may have been that I had an old version of the MySQL libraries and was running into the password-hashing problem. Regardless, I did a clean sweep (although I did leave ruby-gems itself intact, come to think of it) and now everything's copacetic.

  1. Clobbered Ruby. I wanted to upgrade to 1.8.4 anyway, so I deleted /usr/bin/ruby and /usr/lib/ruby entirely.
  2. Got rid of Rails: sudo gem uninstall rails.
  3. New Ruby. I built 1.8.4 from source; note that if you want to overwrite Tiger's default install of Ruby, run configure to tell it so ("./configure --prefix=/usr").
  4. Installed Lucas Carlson's Complete Fix for Ruby on OS X 10.4 Tiger
  5. Downloaded and installed MySQL 5.0 for OS X. (Note that when I tried to use the 64-bit version, the mysql gem did not compile.) If you use the binary package, the installer places all the files in /usr/local/mysql-5.0.whatever and makes a symbolic link to it in /usr/local/mysql. Nice behavior, that--uninstalling is as simple as deleting the folder. I love the Mac.
  6. Installed the mysql gem: sudo gem install mysql --with-mysql-dir=/usr/local/mysql
  7. Reinstalled Rails: sudo gem install rails --include-dependencies
Compiling the RDoc did fail for Active Record, but everything else appears to work, so that I can now debug locally (but with the databases on our Linux DB server) instead of having to copy stuff around to our Web server or another Linux box.

0 Comments:

Post a Comment

<< Home