Fixing Ruby Gems, MySQL and Passenger Phusion on Snow Leopard 10.6

Fixing Ruby Gems, MySQL and Passenger Phusion on Snow Leopard 10.6

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.

  1. You have a new operating system with new binaries. Things don’t line up anymore.
  2. You have a new version of Ruby (1.8.7 instead of 1.8.6) and you may need updated gems.
  3. The upgrade deletes your mysql symlink

Here are the steps to take to fix the issues.

Install Xcode

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

cd /download/and/untarred/folder/
./configure
make
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.

In the /etc/apache2/httpd.conf file they added three new lines. It was this:

<IfModule passenger_module>
NameVirtualHost *:80
Include /private/etc/apache2/passenger_pane_vhosts/*.conf
</IfModule>

and is now this:

<IfModule passenger_module>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName _default_
</VirtualHost>
Include /private/etc/apache2/passenger_pane_vhosts/*.conf
</IfModule>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值