Hello, I’m a web craftsman with a passion for the modern web. I build web applications and play with social services and communities.

December 11, 2009 at 2:04 am

I spend the last couple of hours trying to get Ruby on Rails (2.3.5) to work with MySQL on Mac OS X 10.6 Snow Leopard. So far I have been using SQLite for Rails Development but a current project requires some MySQL specific functions. I didn’t expect things to be so rough but now everything works and I am quite happy. So happy that I decided to write it down and share it with the world.

First: What was the problem?

Since I’m coming from PHP/MySQL development I had XAMPP already installed on my system and I was hoping to use the same XAMPP-bundled MySQL Server I have been using for all my PHP projects for rails projects too. Forget it! Don’t waste your time here. You may get it to work somehow but you will run into trouble at some point since XAMPP’s MySQL is compiled in 32bit and Ruby on Snow Leopard in 64bit. So basically as soon as you have a Mac with a Core 2 Duo (or any other 64bit processor) and running 10.6 Snow Leopard you have to install a 64bit version of MySQL.

So the problem you will run into (or already ran in and that’s why you are here right now) while trying to install the mysql gem with sudo install mysql looks like this:

Building native extensions.  This could take a while…
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
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… 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
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no
*** 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.

and some more I won’t bore you with.

So here comes the solution:

1. Download MySQL 5.4 beta for Mac OS X 10.5 as x86_64 version from the official MySQL website

2. Open up the downloaded .dmg and run the mysql-5.4.x-…x86_64.pkg installer, followed by the MySQLStartupItem.pkg Installer. After that you install the MySQL.prefPane which allows you to start and stop the MySQL Server comfortably from the System Preferences (for some reason the prefPane is still in 32bit but that won’t bother us now).

3. Go into terminal and install the mysqlplus gem:

sudo gem install mysqlplus

4. That’s it!

It seems a bit crazy that I spend hours figuring that out but basically the key to success is mysqlplus here. I tried all kinds of combinations with the official MySQL 5.1/5.4, XAMPP’s MySQL, MacPorts MySQL and the standart mysql gem but none worked. Sometimes I got the mysql gem to compile and install but then rails still couldn’t connect to the database… However, now it works and I’m glad things can go on!


November 20, 2007 at 10:39 pm

Mac OS X Leopard Server Disk

This article is related to 24 hours of Mac OS X Leopard Server.

After 72 hours everything is different…

Eventually I got the Web, Wiki and iCal Server to work. The folders to store the content of the services haven’t had the right rights to get accessed by the services.

So far the Wiki and iCal Server look very good! Excellent ajax interface for the wiki server which makes formatting posts and attaching files enjoyable. The same for iCal. Very impressive.

Unfortunately AFP does crash now every time a client tries to connect. Not only that AFP crashes, it also brings the whole server down. I didn’t change any setting for AFP and can’t even look for a fix. Every time I try to connect with Server Admin the server crashes as well. Eventually my only choise:

Reinstall. Damn. Gonna be a long night. I hope 10.5.2 will make things easier.


November 18, 2007 at 9:02 pm

Apple is known for it’s well working hardware+software packages which work from the first moment on without any trouble and just a fast and painless configuration.

Unfortunately that is not the case with Leopard Server. New software is always buggy. So I decided to wait with the Leopard Server installation until Apple released 10.5.1. However, even 10.5.1 makes a lot of problems on a fresh installed system.

System: Apple XServe 2x 3GHz Intel Xeon

The system ran 10.4.10 before very smoothly. Instead of upgrading 10.4 to 10.5 I decided to do a clean install to avoid problems with the upgrade process.

First problem: the remote installation didn’t work, so I had to plug a screen, keyboard & mouse in the server room. Ok not a big deal and the rest of the setup worked well. Approximately one hour later and 10.5.0 was running.

The first thing I did was updating to 10.5.1 with the downloaded update package from the apple page. No problems with the update.

Now I wanted to configure the server as a gateway. Needed services: DHCP, NAT, Firewall.

While NAT and Firewall worked fine after starting, DHCP didn’t work at all. The Service indicator was green but still the clients didn’t get any IP-Addresses. The DHCP log showed:

can’t open /etc/bootptab (I do still get this message)
subnets: create failed, Invalid/missing ‘net_address’ property

the missing net_address property caused the issue.
Adding it by hand to
/etc/bootpd.plist
fixed the problem.

So at least the clients do get IP addresses and can access the internet.

A lot faster and stable is AFP now. One thing that works…wow! But the possibility to use a server disk as time machine destination didn’t want to work either. Have no fix for this so far.

Next problem: Software Update Server. Doesn’t work at all. There are a lot of people in the Apple Forums with the same issue. No fix so far.

Sometimes the Workgroup Manager tells me that my username/passwort are wrong. 5 minutes later it works. Again, don’t know what’s the problem there and can’t reproduce the error. Seems to be totally random!

Eventually I gave the Software Update Server up and stopped the service. It’s not really needed anyway and will get fixed with 10.5.2 hopefully.

So I went over to some more important services: iCal Server and Wiki Server.
Both refuse to work! The Web server crashes with the following message:

Nov 18 21:22:48 peacechild com.apple.wikid[6526]: Removing stale pidfile /var/run/wikid.pid
Nov 18 21:22:48 peacechild com.apple.launchd[1] (com.apple.wikid[6526]): Exited with exit code: 1
Nov 18 21:22:48 peacechild com.apple.launchd[1] (com.apple.wikid): Throttling respawn: Will start in 9 seconds

No fix so far. Didn’t spend a lot of time in this because I was sick of the whole Leopard Server.
Bugs over bugs. Some are ok and normal. But that many major problems with a freshly installed system???
Apple what did you do there? This is not a business-ready product!

Mac OS X Server Box