Technology from the trenches

The MySQL ruby gem on Leopard (client)

Friday, February 8th, 2008

rubygems.png I just started getting back into Ruby on Rails, after a hiatus while I battled with Leopard server. I discovered that setting up my Rails development environment in Leopard wasn’t as perfectly straightforward as it was in Tiger.

I installed the binary distribution of MySQL, and proceeded to install the mysql ruby gem to connect to it. First, the build failed because it didn’t know where to look for the mysql client libraries, then it failed again because by default the Makefile tries building for both PPC and Intel architectures.

To make a long story short, the solution is to add an ARCHFLAGS environment variable specifiying your architecture, and to provide the path to mysql_config on the command line. For the former, add:

ARCHFLAGS="-arch i386"

To your /etc/bashrc (assuming you use the default shell, bash), and open a new terminal or run ‘bash’. If you’re on PPC architecture, change “i386″ to “ppc”. Then try the gem again with the path to mysql_config appended, like so:

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

That is all on one line.

Tags: , , , ,

Apache2, PHP and MySQL on Mac OSX

Monday, July 24th, 2006

I recently setup the so-called “MAMP” (MacOSX, Apache2, MySQL and PHP) on my laptop, so I can have a portable web development environment. I decided to use MacPorts (formerly DarwinPorts) for Apache2 and PHP5, which makes things a lot easier. There were a few “gotchas” though, so I thought I’d share what I learned. If you want an installation completely based on MacPorts builds, this site has some good instructions.

MySQL Preference Panel I went with the binary installation package from MySQL.com, instead of using the MacPorts version, for aesthetic reasons: it comes with a cool preference panel component for starting and stopping the server (click the thumbnail to the right for a larger image). Using this version instead does require a slight tweak to get the MacPorts packages to link to it, but its easy to do.

(more…)

Tags: , , , , , ,