Instalando gem MySQL con MAMP para RAILS
April 23rd, 2009
After much frustration, I found a way to get the Ruby mysql Gem installed and talking to my MySQL server on MAMP. Credit goes largely to “Hootbah” who followed a similar path to get MAMP talking to Perl’s MySQL library. Here’s the steps I followed for MAMP 1.7.2:
- Install the regular MAMP 1.7.2 dmg package.
- Download the MAMP 1.7.2 source code.
- Unzip the source code file.
- Open the terminal and go into the source code directory.
- Untar the mysql file and go into the untarred directory:
$ tar -xzvf mysql-5.0.41.tar.gz
$ cd mysql-5.0.41 - This is the Hootbah magic…we’re basically compiling libraries here for the Gem to link against.
$ ./configure –with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock –without-server –prefix=/Applications/MAMP/Library
$ make -j2 - Copy the compiled libraries into MAMP:
$ cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql - Copy the MySQL headers into MAMP…Hootbah didn’t do this but I had been doing it earlier trying to get around some missing mysql.h problems, and figured I’d keep doing it:
$ mkdir /Applications/MAMP/Library/include
$ cp -R include /Applications/MAMP/Library/include/mysql - Install the Ruby MySQL Gem:
$ sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-config=/Applications/MAMP/Library/bin/mysql_configAfter being used to seeing errors spit out by this statement, finally a pleasant surprise:
Building native extensions. This could take a while…
Successfully installed mysql-2.7
1 gem installed
Fuente:http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html
Leave a Reply