MAMP and the Ruby MySQL Gem
这是转贴的,原文如下:
After much frustration, I found a way to get the Ruby mysql Gem installed and talking to my MySQL server on MAMP. Here's the steps I followed for MAMP 1.7.2:
Success!
After much frustration, I found a way to get the Ruby mysql Gem installed and talking to my MySQL server on MAMP. 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_config
After 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
浙公网安备 33010602011771号