RSS icon Home icon
  • Mac OS X Snow Leopard + Rails, MySQL, and Sphinx

    Posted on August 26th, 2009 schmeeve 13 comments

    Ah, Snow Leopard. While you’re admiring the photoshop job Apple did to the box art, you may be eager to install the new Leopard, but hang on if you’re using Rails.

    If you’re getting the following types of error with the mysql driver, you may need to reinstall.

    The error:

    !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
    rake aborted!
    dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): no suitable image found. Did find:
    /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

    The fix:

    sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

    (h/t here)

    Sphinx/Ultrasphinx:

    If sphinx is already installed (and searchd starts up without issue), you may be set. However, if you’re installing it new, you’ll want to compile it in 32-bit mode:

    Download the latest tarball of Sphinx here.

    ./configure CFLAGS="-O -arch i386" CXXFLAGS="-O -arch i386" LDFLAGS="-arch i386" --disable-dependency-tracking
    make
    make install

    RMagick:

    NOTE: Despite trying this, I still am having issues with RMagick. If anyone’s got tips…

    UPDATE: As per Dimitri’s (big hat tip!) post below, I *finally* got everything going using MacPorts, which I hadn’t realized was updated for Snow Leopard yet.

    Didn’t go so smoothly, but finally succeeded. Just threw in the towel and got my old MacPorts install out of the way and started over.

    To uninstall MacPorts completely (big caveat: this will uninstall everything previously installed with MacPorts):

    sudo port -f uninstall installed
    
    sudo rm -rf /opt/local \
    /Applications/MacPorts \
    /Applications/DarwinPorts \
    /Library/Tcl/macports1.0 \
    /Library/Tcl/darwinports1.0 \
    /Library/LaunchDaemons/org.macports.* \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Receipts/MacPorts*.pkg \
    /Library/Receipts/DarwinPorts*.pkg \
    ~/.macports

    Then installed libxml2 and ImageMagick as Dimitri recommends, followed by:

    sudo port install rb-rubygems
    sudo gem install rmagick