A collection of computer systems and programming tips that you may find useful.
 
Brought to you by Craic Computing LLC, a bioinformatics consulting company.

Monday, November 24, 2008

Installing Rails 2.2 on Mac OS X - MySQL problem

Rails 2.2 is out and you want to install it - but you may run into this issue on Mac OS X.

1: Make sure you have upgraded to rubygems 1.3.1
$ sudo gem update --system

If that barfs try this which does the same thing a different way:
$ sudo gem install rubygems-update
$ sudo update_rubygems


2: Install Rails
This should install just fine
$ sudo gem install rails

3: 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 installed


4: 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.dmg


Both 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-x86


Install 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

43 comments:

Unknown said...

You are a life saver. Cheers for this!

fguillen said...

For me does not work:
$ sudo update-rubygems

But
$ sudo update_rubygems

Thanks
f.

Doow said...

Nice - this finally saved my day.

Thanks thanks

o on the web said...

I luv u ... lol

Rick said...

Thank you!

Unknown said...
This comment has been removed by the author.
Unknown said...

Thank's !
That's a great help for me.

KedarsThoughtsWork said...

Yes, that's true. This was of immense help. Thank you! Who would have known mysql gem needs x86 and not x86_64?

BTW, does it mean that I have to run mysqld in 32 bit to run with rails?

gomez said...

Thank a lot for the mysql install hint!!!

Have a long Life

Axel

Unknown said...

AWESOME. Thanks so much :)

Unknown said...

Man, thank you so much. I tried so many different suggestions, but only yours works. You rock! :-)

Amy Unruh said...

thanks so much!

James Tuttle said...

you are my hero thanks so much what a nightmare this was!

Jeremy Roush said...

Much thanks.

Anonymous said...
This comment has been removed by a blog administrator.
Gordon Yeong said...

Sorry, I am not having much luck.
"$ 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 installed"

doesn't work.
When i did that on my snow leopard os x, i got more errors as follows:

gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
WARNING: Installing to ~/.gem since /opt/local/lib/ruby/gems/1.8 and
/opt/local/bin aren't both writable.
WARNING: You don't have /Users/anexiole/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
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

....

Unknown said...

This whole information is absolutely interesting. i like this blog because is easily understandable, and this is invaluable to the readers.I think Os x is really great.
buy viagra

Maria said...

BTW, does it mean that I have to run mysqld in 32 bit to run with rails.
mariah carey perfume
discount perfumes

kakkiku said...

I find the articles are interesting and worth to read

mobil keluarga ideal terbaik indonesia|cheap fax machines

pedro velasquez said...

Chef from opscode.com is a suite of tools fordominical costa rica tours managing computing infrastructure, from spinning up new nodes to installing Ruby gems to any custom operation you care to code up. It gets great reviews from those who manage numbers of unix (and other) systems and it has support for Amazon AWS and other cloud vendors baked right in.
http://www.dominicalcostaricatours.com

Anonymous said...

Nice post!! Thanks for sharing!!!
Viagra Generico

Anonymous said...

Nice post! Thanks for sharing!
Comprare Viagra

Anonymous said...

I like football, prefer the beautiful and stylish football shoes to introduce New nike soccer shoes.Prefer the blackout nike vapor

Frank said...

Hey,
Loving your blog, awesome tips on blog you have here. I
would just like to ask you some questions privately, mind real player 11,IDM Free Download,function venues geelong,la Fitness locations,la Fitness

Yuesir said...

black boots

Chocolate boots

sand boots

Chestnut boots

gray boots

pink boots

grey boots
pink boots


Black Ugg Boots

Chestnut Ugg

Boots


Chocolate Ugg

Boots


Grey Ugg Boots

Ugg Boots On Sale

Imran said...

Thanks for sharing this great article! Lingerie

Muhammad Alexander said...

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.



the best seo company

Admin said...

Now a days there are minimum users who used Mac for personal purpose.I totally sure about that because i also researched on it.

Facebook Development

Kyle Grando said...

Good share, great article, very useful for us. keep posting kind of blogs in the future. thanks for sharing post. its a really useful list. good work.

Indigo Hotel DALLAS

Mohtasham said...

good informative blog, I always read your blogs whenever I get free. Keep on updating it with new stuff, I love your work. latest sms l how to make chicken biryani l tandoori chicken recipe l home exercises

amhash said...

I will try my best to do like that. That's a called a creative thinking. Nice post dude. Share some more like that.
Affordable Logo Design

Unknown said...


I read and walked for miles at night along the beach, writing bad blank verse and searching endlessly for someone wonderful who would step out of the darkness and change my life. It never crossed my mind that that person could be me.
business electricity tariffs

Unknown said...

Site's character and a great color match .. Meme estetiğiI will recommend your site to the other platforms.

Unknown said...

Thank you! Cheap Nike NFL Jerseys
Cheap NBA Jerseys

Anonymous said...

Yes, it is true. It is a great help. Thank you! Who will know mysql gem need x86 and not x86_64?
By the way, this means that I must run in 32 bit mysqld running rails?
cheap nfl football jerseys

Unknown said...

Really i appreciate the effort you made to share the knowledge.I would like to see extra posts like this.This is nice post which I was awaiting for such an article and I have gained some useful information from this site. Thanks for sharing this information.mirza maqbool | Maqbool mirza

Unknown said...

very nice post, i certainly love this website, keep on it.cabs in w2 | cab w2 | w2 taxis

Unknown said...

I really like and appreciate your article post.Really looking forward to read more. Really Cool.taxis in w2 | minicab to airport | airport drop w2

dolinna said...

Congratulations for this wonderful reading article. I found it very informative and interesting too, I think you are a brilliant writer. I have bookmarked your blog and will return in the future. I want to encourage you to continue that marvelous work, have a great daytime!I am a china tour lover,You can learn more: China travel | private China tours | China Tourist Attractions

Liza said...

Really appreciate your professional approach. These are pieces of very useful information that will be of great use for me in future.

Mumbai Escort

Unknown said...

Very nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. Nehru jacket

IT Innovation Inc said...

WS-C2960X-48LPS-L
ws-c2960x-48fpd-l
WS-C2960S-48TD-L
WS-C2960X-48LPD-L
WS-C2960S-24TS-L
ws-c2960x-48td-l
ISR4331-SEC/K9

satyaET said...

Organic Food Products

Archive of Tips