1: Make sure you have upgraded to rubygems 1.3.1
$ sudo gem update --systemIf that barfs try this which does the same thing a different way:
$ sudo gem install rubygems-update
$ sudo update_rubygems2: Install Rails
This should install just fine
$ sudo gem install rails3: One important change in 2.2 is that the Mysql database driver is no longer bundled and you have to install yourself. But the obvious command may well fail like this:
$ sudo gem install mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
[...]The issue is that the gem needs more information about your MySQL installation, so do this instead:
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.7
1 gem installed4: That looks good but you may not be out of the woods yet... I got this when I tried a rake db:migrate
$ rake db:migrate
(in /Users/jones/Documents/myapp)
!!! 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!
dlsym(0x1c71570, Init_mysql): symbol not found - /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
After some poking around I found reference to the version of mysql that is installed.
I installed mine as the packaged disk image from mysql.com. For Mac OS X 10.5 you have the choice of these two:
mysql-5.0.67-osx10.5-x86.dmg
mysql-5.0.67-osx10.5-x86_64.dmgBoth work fine on my MacBook but the mysql gem wants the '_x86' version, not the '_x86_64'
Look in /usr/local to see which you have symlinked in:
$ ls -l /usr/local
[...]
lrwxr-xr-x 1 root wheel 24 Nov 24 09:35 mysql -> mysql-5.0.67-osx10.5-x86Install the correct version, reinstall the gem just to be safe, and try your rake again - it should be fine!
IMPORTANT
If you do have the same issue and install the non _64 version on top of the _64 one then mysql will NOT copy over your data files. To fix this:
1: Shut down MySQL
2: In the new (non _64) version
$ sudo mv data data.bak
$ sudo cp -pr ../mysql-5.0.67-osx10.5-x86_64/data .3: Start up MySQL