
After much hesitation, I took the dive and upgraded to Snow Leopard today. I ran into some ruby and MySQL errors, but other early adopters in our dev team had already prepared me for that. However, I would soon run into an issue that got me stumped. It turned out that I had forgotten something really simple.
So I had reinstall MySQL 64-bit and updated all my gems, but a particular mysql gem would refuse to reinstall.
There was this helpful document that several devs on my team sent me: http://stackoverflow.com/questions/991708/rails-mysql-and-snow-leopard
Unfortunately, I would get the following error even executing the recommended solution:
yowhan:~ $ sudo env ARCHFLAGS=”-arch x86_64″ gem install -V mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
GET 200 OK: http://gems.github.com/latest_specs.4.8.gz
GET 200 OK: http://gems.rubyforge.org/quick/Marshal.4.8/mysql-2.8.1.gemspec.rz
Installing gem mysql-2.8.1
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/COPYING
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/COPYING.ja
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/History.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/Manifest.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/README.txt
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/Rakefile
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/README.html
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/README_ja.html
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/extra/tommy.css
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql.rb
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/gem.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/native.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
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
sudo env ARCHFLAGS=”-arch x86_64″ gem install -V mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
GET 200 OK: http://gems.github.com/latest_specs.4.8.gz
GET 200 OK: http://gems.rubyforge.org/quick/Marshal.4.8/mysql-2.8.1.gemspec.rz
Installing gem mysql-2.8.1
…
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
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
…
*** 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.
…
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
After several frustrating moments of poking around, a helpful fellow developer pointed out that “mysql” was not in my path. Duh!
I guess I just committed a newbie linux mistake. A quick update to .profile to include “/usr/local/mysql/bin” later, and the above command works perfectly now!
Here’s what I added to my .profile:
#Add mysql to path
export PATH=/usr/local/mysql/bin:$PATH
Hopefully that’s the last of my upgrade issues. :)