George MacKerron: code blog

GIS, software development, and other snippets

MySQL gem for Ruby 1.9.1/1.9.2 on Snow Leopard (Mac OS X 10.6)

The secret to getting the MySQL gem to install and function with Ruby 1.9.1/1.9.2 on Snow Leopard is:

  • Install MySQL using the 64-bit .DMG package installer from dev.mysql.com
  • Install Ruby using RVM (that’s Ruby 1.9.2 or 1.9.1-p378 — at the time of writing the latest 1.9.1, p429, is buggy)
  • Add these to lines to ~/.bash_login or ~/.bashrc:
export PATH="/usr/local/mysql/bin:$PATH"
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
  • In a new shell (Terminal window), type gem install mysql as normal.

I’m posting this mainly as a record for myself, having wasted a lot of time in the past trying strange incantations from comments on various other blogs posts.

Share

Written by George

August 4th, 2011 at 3:47 pm

Posted in Mac,Ruby,SQL,System admin