One of the first things I noticed after upgrading to Snow Leopard is that my Passenger based sites stopped working. I use this heavily for Rails development, so I needed it fixed. The first thing I tried was reinstalling Passenger Phusion, which led to an error.
ERROR: Error installing passenger:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install passenger
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/passenger-2.2.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/passenger-2.2.4/ext/phusion_passenger/gem_make.out
There are several reasons for this.
- You have a new operating system with new binaries. Things don’t line up anymore.
- You have a new version of Ruby (1.8.7 instead of 1.8.6) and you may need updated gems.
- The upgrade deletes your mysql symlink
Here are the steps to take to fix the issues.
This is available on the Snow Leopard DVD in the Optional Installs directory.
Install the iPhone SDK
If you have previously installed the iPhone SDK for Leopard, you’ll need to reinstall. You can download and Install the iPhone SDK for Snow Leopard. It is build specific to Snow Leopard, so be sure to grab the right dmg file.
Install MySQL 64-bit
If you are running 64-bit hardware, OS X is now fully 64-bit compliant and your MySQL libraries probably aren’t! You’ll need to download the 64-bit version and reinstall.
Next we are going to move the default data files out and restore our original data files that the install moved.
First, go stop mysql using the preference pane. I’ll wait.
Ok, now go run the following commands:
Note: You need to tailor the last command to pull from the previously installed version of MySQL. You can do an
ls /usr/local/ directory to find out.
sudo mv /usr/local/mysql/data /usr/local/mysql/data.default
sudo mv /usr/local/mysql-5.0.67-osx10.5-x86/data /usr/local/mysql/data
You’ll also need to recreate the symlink for you socket.
sudo ln -s /var/mysql/mysql.sock /tmp/mysql.sock
Re-Install Your Broken Gems
Any gem that requires compilation (passenger, mysql, RedCloth, thin and hpricot are good examples) must be recompiled using the new gcc compiler that is installed with XCode.
sudo gem install passenger
sudo gem uninstall mysql
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
You still need to pass the ARCHFLAGS command like you did under 10.5 Leopard.
More to Come?
Probably, but that’s it so far. I’ll update this post if I find any more issues.
Update 1a: Passenger PrefPane
It doesn’t load and reinstalling it doesn’t work for me. It appears to be an issue with RubyCocoa, but not sure yet. In the mean time, just add your *.local domains to to your /etc/hosts file. Thanks to David for the fix in the comments.
Once you install Ruby Cocoa 0.13.2 with the plist change (allows you to install on 10.6) you may need to change your pref pane entries. I added a letter to the alias of each, then deleted it back out and applied the change.
sudo apachectl restart
After that it picked the local domains right up and I was good to go.
Update 1b: Passenger PrefPane 1.3 is Out!
Eloy has release a new update that is compatible with Snow Leopard. Great work! Read more about it and download it on his blog.
Update 2: ImageMagick and RMagick
So the upgrade toasts Mac Ports and ImageMagick.
Yep, blow it all away. It’s too much of a pain.
rm -rf /opt/local
Now download Mac Ports for Snow Leopard and install.
You might want to go eat or get a beer for this next step. Then again, maybe not. You have a faster OS now! Nope, you still need that beer.
sudo port install libxml2
sudo port install ImageMagick
sudo gem install rmagick
Update 3: Git
I just don’t trust potential binary issues and am upgrading to the latest. You should too. WARNING: As of 8/29/2009 expat is not the correct architecture and you can’t install git yet so wait a few days. I did some testing and git seems good to go. I will upgrade as soon as this is fixed though.
Blowing away Mac Ports in Update 2 solves the issue!
If you were using Mac Ports previously, you’ll have problems you need to fix.
sudo port install git-core +bash_completion +doc
or via downloaded file
sudo make install
Update 4: Fixing an Incorrect DirectoryIndex in Apache
We came across an issue this morning with Apache not using the correct DirectoryIndex (default document such as index.php). It seems the code to include the passenger prefpane vhosts has changed slightly.
/etc/apache2/httpd.conf file they added three new lines. It was this:
and is now this: