Saturday, July 23, 2011

Steps to install MySQL2 GEM (Ruby on Rails) on Windows 7 (64 bit)

I ran into many issues trying to get it compiled and installed on Windows 7 64-bit and wished I had an "apt-get" that would have fixed all these issues.

The trick here is: you need MySQL 32-bit to have Ruby on Rails MySQL2 gem compiling on Windows 7 64-bit. In short, this is what I had to do:

  1. Install Ruby Development Kit in order to be able to compile C-bindings for Ruby
    • Error: The 'mysql2' native gem requires installed build tools.
  2. Install MySQL Server 64-bit
  3. Download MySQL Server 32-bit .zip file
  4. Add MySQL 32-bit lib directory to PATH (or copy libmysql.dll to %RUBY_HOME%\bin)
  5. Install MySQL2 2.0.6 GEM specifying --with-mysql-lib and --with-mysql-include options pointing to the 32-bit lib and include directories
    • gem install mysql2 -- '--with-mysql-lib="c:\Development\MySQL Server 5.5\lib\opt" --with-mysql-include="c:\Development\MySQL\MySQL Server 5.5\include"'
  6. Install Rake 0.9.2
    • Error: uninitialized constant Rake::DSL
References:
Post a Comment