Upgrading to Snow Leopard

Posted by Matt Aimonetti August 30, 2009 @ 11:03 PM

Last Friday, Apple released their new OS version: Snow Leopard. Upgrading to SL is very easy and even gives you back quite a lot of HD space. However a few things have changed in the OS and you need to understand what is going on so you won't get frustrated with the updating process and won't be wasting time fighting with the system.

Snow Leopard

The key change for us Ruby developers, is the fact that, in Snow Leopard, all the interpreted languages (including Ruby) are now running in 64-bit by default (obviously, only if you have a 64-bit machine). For pure Ruby applications and libraries this shouldn't pose any problems. But if you are migrating from a Leopard environment where you compiled C extensions for 32-bit only, these gems won't properly load in Snow Leopard. Same thing goes for libraries you might have compiled in 32-bit mode and that you might want to use on your migrated system.

Something else you need to know: Snow Leopard now comes bundled with Ruby 1.8.7 instead of 1.8.6. This should not be a problem since Rails has been running on Ruby 1.8.7 for a long time and Rails 3 will require Ruby 1.8.7 and prefer Ruby 1.9.2.

Here is a quick rundown of common tasks you might have to do to migrate properly.

Install Snow Leopard developer tools

On the Snow Leopard DVD, under “Optional Installs”, install “Xcode.mpkg”. Use all default options.

Passenger

$ sudo gem install -r passenger
$ sudo passenger-install-apache2-module

Press Enter when prompted. Passenger will compile and install its Apache module. Press Enter when prompted the second time too.

$ cd /etc/apache2

Open httpd.conf in your text editor (if you use TextMate, try running mate httpd.conf from the command line) and look for a line like “LoadModule passenger_module” and some lines following that have “passenger” in them too. Delete them. If you don’t see them them, move your cursor to the end of the file.

Then insert these lines:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.4
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

MySQL

To avoid weird issues with MySQL, it's strongly recommended to upgrade to the 64-bit version. Start by shutting down mysqld if it's running. (Depending on how you installed MySQL, you might be able to use the preference panel, or use sudo /opt/local/share/mysql5/mysql/mysql.server stop if you installed it using MacPorts)

Now install the Mac OS X 10.5 (x86_64) version of mysql from here

When the disk image opens, first install “mysql-5.1.37-osx10.5-x86_64.pkg”. Use all default options.

Next install “MySQLStartupItem.pkg”. Use all default options.

Next install “MySQL.prefPane”. Double-click to install it. Choose to replace the existing preference pane when prompted. (Apparently the preference pane is still 32-bit.) At this point you can click “Start MySQL Server” to start the server and verify it works.

Unmount the MySQL disk image.

Since you are upgrading from Leopard, your mysql gem is compiled for 32-bit only and therefore needs to be recompiled. However, it's not that simple, the mysql gem is a bit of an exception. Under Snow Leopard when you do a gem install for a C extension it tries to build the extension for two architectures: i386 (32-bit) as well as x86_64 (64-bit). The problem is that the binary from mysql.com is not universal and therefore we need to force the C extension to be only compiled in 64-bit.

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

note: You shouldn't have to set the ARCHFLAGS to compile any other gems.

MacPorts

You should be all set. However, if you are relying on any libraries you compiled on Leopard, you probably will have to recompile them. MacPorts users shouldn't think that it will be automatically done for them.

You have different options to upgrade your ports.

The easiest way is to upgrade MacPorts:

$ sudo port selfupdate
$ sudo port sync
$ sudo port upgrade --force installed

Other native gems

Check this script to get a precise list of gems requiring to be reinstalled and some help with the upgrade process. Basically, you just need to reinstall the few gems using C extensions.

Posted in Activism | 63 comments

Comments

  1. Erb on 31 Aug 00:34:

    Matt, nice writeup! Very helpful.

    The only hiccup could be that the script that checks the gems will find mysql and passenger even though earlier in the article we updated them. So you just have to take ‘mysql’ and ‘passenger’ out of the “sudo gem uninstall…” list instead of blindly copy/pasting it…

    thanks again!

  2. Matt Aimonetti on 31 Aug 01:03:

    @erb good catch, I fixed the script to skip mysql and passenger.

    Thanks,

    - Matt

  3. Matt Aimonetti on 31 Aug 01:10:

    Mike, I’m sorry I deleted your comment by accident. (I wanted to delete erb’s duplicate comment but I got distracted by Ninh and deleted your instead :( )

    You were suggesting to use http://github.com/mxcl/homebrew/tree/masterbrew instead of MacPorts.

    - Matt

    p.s: again sorry about that, but feel free to blame Ninh Bui ;)

  4. Matt Aimonetti on 31 Aug 03:33:

    If for some reasons you are not able to upgrade your gems/libs and want to run Ruby in 32-bit mode, you can always use the “arch -i386” prefix.

    $arch -i386 ruby -e "p 'this is ruby running in 32-bit mode'"
  5. Cary on 31 Aug 04:21:

    thanks!

  6. swoon dot net on 31 Aug 04:33:

    i have a small announcement to make for those snow leopard users who use mysql.

    some background: the current mysql prefpane is not 64-bit compatible with snow leopard and consequently the system preferences app will restart itself in 32-bit mode in order to load the current 32-bit prefpane.

    my lack of patience with the mysql group resulted in my building and releasing a new mysql prefpane (and source code) for snow leopard users.

    the prefpane requires the mysql software and startupitems to be installed on your mac, but most people who use mysql have already done that.

    here is the url:

    http://www.swoon.net/site/software.html

    ...and the software is free.

  7. james wilson on 31 Aug 04:38:

    As much as I occasionally get mac envy, I Just have to mention in this thread that Ubuntu rocks.

  8. Chris Lerum on 31 Aug 05:07:

    um, the bit about blindly copy/pasting those 3 lines for passenger – one should actually grab that text from the passenger install output (it can vary depending on where your ruby is, etc.)

  9. Peter Cooper on 31 Aug 05:54:

    Just a note to anyone deciding whether to upgrade or “go fresh”.. just go fresh. Even after getting everything “pretty much” working I decided to go fresh because there’s just too many niggly or crufty things to make you feel confident about it all after a mere upgrade. I had to make backups of a terabyte of stuff and it took a cpl days but.. it was totally worth it. Snow Leopard is far more stable from fresh.

  10. Matt Aimonetti on 31 Aug 06:21:

    @peter with all due respect, I have to disagree with you. I’m not saying that a clean install is better than an upgrade but if you didn’t do some crazy stuff on your machine, upgrading doesn’t make your system unstable. I personally enjoyed a trouble-less update and don’t see the need to do a fresh install. Now, if you can afford to do a clean install, do it :)

  11. Guyren Howe on 31 Aug 07:37:

    Did as you describe. MySQL is running (although it won’t start or stop via the control panel).

    But when I try to hit my Rails app, I get:

    NameError (uninitialized constant MysqlCompat::MysqlRes): /vendor/rails/activesupport/lib/active_support/dependencies.rb:442:in `load_missing_constant’ /vendor/rails/activesupport/lib/active_support/dependencies.rb:77:in `const_missing’ /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:9:in `define_all_hashes_method!’

  12. Grzegorz Derebecki on 31 Aug 08:10:

    When i run

    sudo env ARCHFLAGS=”arch x86_64” gem install mysql -—with-mysql-config=/usr/local/mysql/bin/mysql_config

    gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -DHAVE_MYSQL_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include -g -Os -arch ppc64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c mysql.c

    ...

    ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture ld: warning: in /usr/lib/bundle1.o, missing required architecture ppc64 in file ld: warning: in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.dylib, missing required architecture ppc64 in file ld: warning: in /usr/lib/libz.dylib, missing required architecture ppc64 in file ld: warning: in /usr/lib/libm.dylib, missing required architecture ppc64 in file ld: warning: in /usr/lib/libpthread.dylib, missing required architecture ppc64 in file ld: warning: in /usr/lib/libdl.dylib, missing required architecture ppc64 in file ld: warning: in /usr/lib/libSystemStubs.a, missing required architecture ppc64 in file ld: warning: in /usr/lib/libSystem.dylib, missing required architecture ppc64 in file ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/dylib1.o/bundle1.o) for architecture ppc64 collect2: ld returned 1 exit status lipo: can’t open input file: /var/tmp//ccNmcEps.out (No such file or directory) make: * [mysql_api.bundle] Error 1

    Why it still wants build on -arch ppc64 ?

  13. Matt Aimonetti on 31 Aug 08:21:

    @Grzegorz are you sure you are on an Intel machine and you reinstalled mysql x86_64 before uninstalling and reinstalling the mysql gem?

  14. joost on 31 Aug 09:53:

    For installation/configuration of Passenger inside Apache, I would recommend against modifying httpd.conf directly. You should put the three Passenger directives in a separate file in /etc/apache2/other, keeping your stock config file clean and makes it much easier to upgrade Passenger in the future (which you will be doing!).

  15. Stefan Haubold on 31 Aug 10:57:

    if you have still problems with installation of the mysql gem and did everything as described above you could check if ”/usr/local/mysql/bin” is in your path. After i added it to my PATH the installation of the gem worked without problems.

    My guess is, that the “—with-mysql-config” param isn’t passed to “ruby extconf.rb”. Can’t say why or if its just a problem on my mac.

  16. madmax on 31 Aug 12:31:

    matt thenks :) don’t know why but i installed mysql for ppc :)

  17. Thomas GALIBERT on 31 Aug 12:47:

    Does anyone have some problems with Postgresql ?

    I have remove and install the gem (with ARCHFLAGS i-386, because, PGSQL bin was not 64 bits) successfully but i cannot start a server. I have always the same message :

    /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection’: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.8.0/lib/pg.bundle, 9): no suitable image found. Did find: (RuntimeError)

    Thanks !

  18. Grzegorz Derebecki on 31 Aug 13:24:

    If you don’t want specify

    sudo env ARCHFLAGS=”-arch x86_64” just add to /etc/profile (zsh: /etc/zshenv):

    export ARCHFLAGS=”-arch x86_64”

    Alos i recommend you to add /usr/local/mysql/bin to path just create file mysql in /etc/paths.d/ with content:

    /usr/local/mysql/bin

    From now you can do just sudo gem install mysql

  19. Olivier on 31 Aug 14:08:

    Thanks ! Very helpful

  20. Javan on 31 Aug 14:51:

    Anyone get the prefpane to actually start/stop mysql?

  21. Javan on 31 Aug 19:11:

    @Guyren Howe and anyone else getting the “uninitialized constant MysqlCompat::MysqlRes” error:

    I found this to be a problem with the 2.8.1 version of the mysql gem. Installing 2.7 worked for me.

    $ sudo gem uninstall mysql

    $ sudo env ARCHFLAGS=”arch x86_64” gem install mysql -v=2.7 -—with-mysql-config=/usr/local/mysql/bin/mysql_config

  22. Adam Martin on 31 Aug 21:00:

    When is Rails 3 coming out? If you don’t release Rails 3 soon I will switch to Ramaze.

  23. Dylan on 01 Sep 02:17:

    FYI… I had to re-install all of my ports (per a few port authors and macport maintainers) due to some libiconv issues, and a list of other lib issues that I won’t bother listing. Had to re-install a bunch of gems as well, but that script referenced in the original post helped a lot (that is, if you have your gem repository in the default location).

    But in retrospect… I’m on a MBP, and I don’t really notice any difference in performance… with the added pain in having to re-install all of my ports :)

  24. Ian Wrigley on 01 Sep 04:03:

    I had problems with “uninitialized constant MysqlCompat::MysqlRes” whenever I tried to run a Rails application after following the procedure above. It turns out, I had Ruby 1.8.6 in /usr/local/bin/ as well as Snow Leopard’s version of Ruby (1.8.7) in /usr/bin. This was causing weird conflicts; removing the version in /usr/local/bin (also remove ‘gem’ in the same directory and reinstalling the MySQL gem as above fixed the problem.

  25. Brendon Muir on 01 Sep 04:59:

    I’m getting this when trying to compile the mysql gem. I’ve installed the 64bit version as per the instructions above. I suspect I need developer libraries for mysql but I can’t see any on the mysql site to download for mac.

    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.

    Provided configuration options: —with-opt-dir —without-opt-dir —with-opt-include —without-opt-include=${opt-dir}/include —with-opt-lib —without-opt-lib=${opt-dir}/lib —with-make-prog —without-make-prog —srcdir=. —curdir —ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby —with-mysql-config —without-mysql-config —with-mysql-dir —without-mysql-dir —with-mysql-include —without-mysql-include=${mysql-dir}/include —with-mysql-lib —without-mysql-lib=${mysql-dir}/lib —with-mysqlclientlib —without-mysqlclientlib —with-mlib —without-mlib —with-mysqlclientlib —without-mysqlclientlib —with-zlib —without-zlib —with-mysqlclientlib —without-mysqlclientlib —with-socketlib —without-socketlib —with-mysqlclientlib —without-mysqlclientlib —with-nsllib —without-nsllib —with-mysqlclientlib —without-mysqlclientlib —with-mygcclib —without-mygcclib —with-mysqlclientlib —without-mysqlclientlib

    Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

  26. Rasmus Rønn Nielsen on 01 Sep 20:03:

    If you like me got this error when using git and when updating mac ports:

    “[something] requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0”

    ... you can find the solution here: http://www.pubbs.net/macports/200908/66027/

  27. Matt White on 02 Sep 04:06:

    Thanks, Ian! You saved my sanity… I can’t even remember how I ended up with the alternate ruby install in /usr/local/bin, but that’s what the problem was. I also had to get rid of irb in that dir as well…

  28. Joseph Silvashy on 02 Sep 05:28:

    You should also be aware that Mac Ports has a specific pkg installer for leopard if you are getting this error:

    dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found.

    Find it here:

    http://distfiles.macports.org/MacPorts/MacPorts-1.8.0-10.6-SnowLeopard.dmg

  29. Peter Iwanowitsch on 02 Sep 13:26:

    Sorry i get a ruby header error: http://nopaste.php-quake.net/251926

  30. Levi Figueira on 02 Sep 14:29:

    I’m getting the same error as #25… :(

  31. grantmichaels on 02 Sep 20:05:

    having done both the upgrade and fresh, i definitely recommend the fresh installed alternative …

  32. Dylanfm on 02 Sep 23:13:

    I was getting the same error as Brendon and Levi above. Once I followed Stefan Haubold’s advice (comment 15) and added /usr/local/mysql/bin to my path it installed fine. Thanks!

  33. Diego Plentz on 03 Sep 01:52:

    update_cadabra could help

    http://github.com/plentz/update_cadabra/tree/master

    as in description… “update RubyGems + gems+ MacPorts + ports, pain-free” :)

  34. Corey Ehmke on 03 Sep 04:41:

    After upgrading MySQL, be sure to grab your old data directory from your previous installation before you delete it.

    A step-by-step guide is posted at http://www.idolhands.com/ruby-on-rails/restore-rails-development-databases-after-snow-leopard-and-mysql-upgrade/

  35. Georges Gabereau on 03 Sep 15:12:

    I installed Snow Leopard clean and set up my dev environment using MacPorts instead of the MySQL package. I found that the MySQL package just causes problems for whatever reason.

    Using MacPorts almost always works better, in my experience.

    Rather than repeat myself, I documented my process here: http://blog.twg.ca/2009/09/livin-on-the-edge-ruby-rails-and-snow-leopard/

    Check it out, hopefully it helps someone.

  36. brookr on 04 Sep 00:29:

    Help! I’ve uninstalled and reinstalled everything a few times, and I’m still getting the following error:

    dyld: lazy symbol binding failed: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/mysql.bundle Expected in: flat namespace

    dyld: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/mysql.bundle Expected in: flat namespace

    Anyone come across anything like this, or know a fix?

    Going on 3 days without my dev env… :(

  37. GooBoo on 04 Sep 06:20:

    Thanks swoon dot net for the 64-bit preference panel. Much appreciated!

  38. Eric on 04 Sep 15:16:

    After following these instruction on a fresh install of Snow Leopard, I now have two myql folders in /usr/local … one called simply ‘mysql’ (which the mysql gem install command in this article seems to be pointing to) and one called ‘mysql-5.1.38-osx10.5-x86_64’. Both directories contain the same files.

    I have ’/usr/local/mysql/bin’ in my path.

    Should the gem install be pointing that the new ‘mysql-5.1.38-osx10.5-x86_64’ directory in /usr/local ?

  39. brookr on 04 Sep 21:07:

    Yay, I fixed the issue in #36.

    I just removed /Library/Ruby/Site/1.8/universal-darwin10.0/mysql.bundle to another location. Apparently, this file was blocking access to the real bundle file that the mysql gem needed. Without it, everything works swimmingly.

    What I don’t understand is why more other people weren’t having this issue…

    Eric of #38, you are correct that there are two directories. The plain ‘mysql’ one should be a so-called symlink to the full directory. This will let you easily upgrade or switch installations simply by redirecting the symlink. Leave it as it is! :)

  40. Luca on 05 Sep 12:31:

    Hey, what about rails 3 release date?

  41. Sandy on 06 Sep 11:43:

    Thomas, do you still have problems with postgres?

    If so just try: sudo gem install postgres

    Did the trick for me …

  42. Amy on 06 Sep 13:01:

    FWIW, I was getting the same error as Guyren (#11) despite compiling with ARCHFLAGS etc.

    I was using a macports install of ruby 1.8.7. It appears the /opt/local Leopard builds are now problematic. I’ve seen suggestions elsewhere that the whole macports set of builds should just be regenerated, which I suspect is true.

    At any rate- once I moved /opt/local out of the way and used the /usr/bin/ruby install, the mysql gem build worked.

  43. Jussi on 06 Sep 13:34:

    Hi all,

    I just spent half a day banging my head against the wall trying to get my brand spanking Snow Leopard back on rails. I had to install Ruby manually to get things right, and in retrospect this was probably due to a previously installed local version under /usr/local

    This recipe worked for me: 1. mysql-5.1.38-osx10.5-x86_64.dmg (installer) 2. readline-6.0.tar.gz 3. ruby-1.8.7-p174.tar.gz 4. rubygems-1.3.5.tgz 5. sudo gem install mysql 6. irb to test

    For information on how to upgrade your MySQL databases (1) see: http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html

    For information on ruby prerequisite Readline (2) see section titled “Ruby” at: http://hivelogic.com/articles/ruby-rails-mongrel-mysql-osx

    For information on building Ruby and Rubygems (3, 4) see: http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/

    Finally, here’s the “gem install” (5) that worked on my system:
    sudo env ARCHFLAGS="-arch x86_64" gem install --verbose mysql -- --with-mysql-include=/usr/local/mysql/include --with-mysql-lib=/usr/local/mysql/lib
    

    Colin Kelley provided an excellent way to test your installation:

    $ irb
    >> require 'rubygems'
    >> require 'mysql'
    >> Mysql.get_client_info
    => "5.1.38" 
    

    Hope this helps some of you guys.

    Cheers, Jussi

  44. Alec on 06 Sep 14:10:

    For those who don’t debug from the command line, it’s worth noting that the latest version of ruby-debug-ide (0.4.8) has significant issues. If you’re having problems, roll back to 0.4.7 and all should be well.

  45. Ken Collins on 06 Sep 17:47:

    I just posted a complete guide for rails development on Snow Leopard. One of my primary audiences was those using the SQL Server adapter that I maintain, but I develop rails applications on both 1.8/1.9 and in SQLite3/MySQL, and this article also covers that too. Hopefully you may find some of the details useful.

    http://www.metaskills.net/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more

  46. cw on 07 Sep 05:55:

    hey brookr,

    had the same problem as in #36 but with a different file and did what you said and bam, it worked!

    this is the first place i’ve seen this issue addressed after scouring around.

    thanks for figuring it out brookr!

    -c

  47. Brendon Muir on 08 Sep 02:55:

    Levi Figueira, in the end the solution was to restart the mac! Not sure why but it worked. This is in reference to #25.

  48. Ted T. on 08 Sep 19:09:

    Has anyone used the OCI8 (Oracle) driver with Snow Leopard?

  49. Grant Sayer on 09 Sep 00:17:

    I recently upgraded from Leopard to Snow Leopard and wanted to build Ruby + Rails from source. As an experiment I downloaded the following:

    1. ruby-1.9.1-p243 2. rubygems-1.3.5 3. mysql-5.-1.37 (as package)

    Building ruby + rails works well and installed via the simple build script:

    ============< build script snippet >=========== #install ruby first cd ruby-1.9.1-p243 ./configure—enable-shared—enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 make make install

    now install rubygems cd ../rubygems-1.3.5 /usr/local/bin/ruby setup.rb now install rails gem install rails add in the mysql adapter gem install mysql——with-mysql-dir=/usr/local/mysql =========< build script snippet>=========== All good. Ruby installs in /usr/local/bin, rails gets setup. Then i tried the usual ‘rails testapp’ to kick start and that generated the typical files. The server starts up ok , but when you try to post for creating a new record you get:

    undefined method `^’ for f

    I’ve noticed others comment that this is a cookie problem or a unicode problem. But no real solutions.

  50. Nic Benders on 09 Sep 17:43:

    After upgrading to the new MySQL package I needed to update my /etc/my.cnf file. The old file pointed to /usr/local/mysql as the datadir, which was being ignored by the new MySQL install. This caused all kinds of problems, since the InnoDB engine was resolving it’s home just fine, but the MyISAM engine was not.

    Changing it to the full path, not the symlink, fixed the problem.

    [mysqld] datadir = /usr/local/mysql-5.1.38-osx10.5-x86_64/data

  51. yves_dufour@mac.com on 09 Sep 22:35:

    all posts seems targeted to 64bit kernel… even if my Macbook has a 64 architecture it’s not possible to boot the 64-bit kernel (EFI-32) ..

    So, after upgrading to SL, running rails 2.3.4/ruby 1.8.7 (32 bits !!) I tried to upgrade to MySQL to 5.1.38 (i686) but I went into troubles trying to upgrade the mysql-client and gem … what could be the process in this case ? there is still life with 32-bits !!! (unfortunatly… )

    thanks for your advices

    erwin

  52. Ron on 10 Sep 09:48:

    Thanks a lot Matt, really saved me here

  53. Robin on 10 Sep 17:45:

    @Brendon: I got the same error. The following step fix it:

    - sudo gem update—system

    and then do the gem install of mysql: - sudo env ARCHFLAGS=”arch x86_64” gem install mysql -—with-mysql-config=/usr/local/mysql/bin/mysql_config

    hopefully it is also working for you..

  54. UGG Classic Cardy on 12 Sep 05:45:

    Only One word to characterize such a great post “WOW” that was a very interesting read

  55. yves_dufour@mac.com on 12 Sep 10:55:

    after re-installing mysql gem (x86_64 arch) and MySQL server (5.1.38 arch x86_64) , all gems, Rails 2.3.4, when I run in the console :

    irb irb(main):001:0> require ‘rubygems’ => true irb(main):002:0> require ‘mysql’ => true irb(main):003:0> Mysql.get_info_client NoMethodError: undefined method `get_info_client’ for Mysql:Class from (irb):3

    why do I get this error ? should be defined ? no ?

  56. yves_dufour@mac.com on 12 Sep 13:46:

    Sorry ! was writing wrong … method IS : get_client_info and it works ..! (shy..)

    require ‘rubygems’ => true require ‘mysql’ => true Mysql.get_client_info => “5.1.38”

    so ,MacBook Core 2 Duo with EFI32 works fine w MySQL x86_64 and gem mysql arch: x86_64

  57. Rob H on 15 Sep 21:23:

    Thanks for this great write up! It was frustrating to upgrade and find so much broken.

  58. michael Martinez on 17 Sep 02:30:

    i use the command “rails newapp” to make a new app and this is what I get:

    /Users/mbmartin/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/fast_xs.bundle: [BUG] Segmentation fault ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

    Abort trap

    any ideas ? ??

  59. Anton Mironov on 19 Sep 22:26:

    For those who have “uninitialized constant MysqlCompat::MysqlRes” problem.

    You need to install mysql gem with the following command: sudo env ARCHFLAGS=”arch x86_64” gem install mysql -—with-mysql-config=/usr/local/mysql/bin/mysql_config

  60. David Golightly on 22 Sep 03:17:

    FYI, for people with 32 bit processors, the above instructions work fine – contrary to expectation, you’re running a 32-bit kernel, but you can safely compile and run 64-bit software. So follow the above instructions just the same even if your processor is only 32 bits. (You may need to prefix

    env ARCHFLAGS=”-arch x86_64”

    to all shell commands in this case.)

  61. zhong@swimconnection.com on 25 Sep 04:28:

    In the Terminal.

    irb >require “rubygems” =>true >require “mysql” dyld: NSLinkModule() error dyld: Symbol not found: _mysql_affected_rows Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle Expected in: flat namespace in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle Trace/BPT trap

    What is the problem of this??? Any help will be very appreciated. Many thanks!

  62. Steve on 28 Sep 18:19:

    When I installed Snow Leopard it ate my copy of gcc. All of the problems I had disappeared when I reinstalled XCode from the Snow Leopard Optional Installs folder.

    If you are experiencing problems, type “which gcc” at the command line. If it returns nothing, reinstall XCode.

  63. chad eubanks on 28 Sep 20:34:

    HELP!!!! No matter what I have tried I keep getting this error. I am working on a MacBook Pro right out of the box with a factory in stall of Snow.

    Here is the error:

    Chad-Eubankss-MacBook-Pro:apache2 chadeubanks$ sudo env ARCHFLAGS=”arch x86_64” gem install mysql -—with-mysql-config=/usr/local/mysql/bin/mysql_config Building native extensions. This could take a while… Successfully installed mysql-2.8.1 1 gem installed Installing ri documentation for mysql-2.8.1…

    No definition for next_result

    No definition for field_name

    No definition for field_table

    No definition for field_def

    No definition for field_type

    No definition for field_length

    No definition for field_max_length

    No definition for field_flags

    No definition for field_decimals

    No definition for time_inspect

    No definition for time_to_s

    No definition for time_get_year

    No definition for time_get_month

    No definition for time_get_day

    No definition for time_get_hour

    No definition for time_get_minute

    No definition for time_get_second

    No definition for time_get_neg

    No definition for time_get_second_part

    No definition for time_set_year

    No definition for time_set_month

    No definition for time_set_day

    No definition for time_set_hour

    No definition for time_set_minute

    No definition for time_set_second

    No definition for time_set_neg

    No definition for time_set_second_part

    No definition for time_equal

    No definition for error_errno

    No definition for error_sqlstate Installing RDoc documentation for mysql-2.8.1…

    No definition for next_result

    No definition for field_name

    No definition for field_table

    No definition for field_def

    No definition for field_type

    No definition for field_length

    No definition for field_max_length

    No definition for field_flags

    No definition for field_decimals

    No definition for time_inspect

    No definition for time_to_s

    No definition for time_get_year

    No definition for time_get_month

    No definition for time_get_day

    No definition for time_get_hour

    No definition for time_get_minute

    No definition for time_get_second

    No definition for time_get_neg

    No definition for time_get_second_part

    No definition for time_set_year

    No definition for time_set_month

    No definition for time_set_day

    No definition for time_set_hour

    No definition for time_set_minute

    No definition for time_set_second

    No definition for time_set_neg

    No definition for time_set_second_part

    No definition for time_equal

    No definition for error_errno

    No definition for error_sqlstate

    Any thoughts, help, and direction will be greatly appreciated.

    Thank you, chad eubanks