开发者

set up MySQL with MAMP for Ruby

I'm trying to use Ruby with the MySQL that comes with MAMP, but there is a problem with the headers not being installed (or something like that).

Someone referred me to the tutorial copied below but I can't get it to work. When I put in the first line ./configure... it says no such directory.

1) One question in particular is, it says, "copy the MySQL source file (mysql-5.1.37.tar.gz) to somewhere on your hard drive." I don't know if by installing MAMP I have already done this step or not. If not, then I don't know what to do.

2) I also don't know what it means when it says "untar" the source file and "cd"...If MAMP is installed, has it been untarred already?

3) Also, do would I just open the terminal and start this code, or do I have to go into Mysql?

I wonder if anyone can tell me how to adapt it. Here are 2 other pieces of information about my installation that might be helpful.

a). MySQL is set up on port 8889 on my computer. b) Also when I enter "which mysql" in the command line, it responds with "/usr/local/mysql/bin/mysql."

Please help if you can. Thanks.

Download the latest MAMP dmg file.
Download the 1.8.2 (or whichever the latest one you could find) components file from this page.
Unzip, mount the dmg, then copy the MySQL source file (mysql-5.1.37.tar.gz) to somewhere on your hard drive.
Untar the MySQL source file, and `cd` to the source file directory.
Compile the library:

$ ./configure --with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock --without-server --prefix=/Applications/MAMP/L开发者_运维知识库ibrary

$ make -j2

Copy the compiled libraries into MAMP:
$ cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql

Copy the MYSQL headers into MAMP:

$ mkdir /Applications/MAMP/Library/include

$ cp -R include /Applications/MAMP/Library/include/mysql

Install the Ruby MySQL Gem, on Snow Leopard:

$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

On Leopard:


$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

Enjoy!

EDIT @ 2009-11-23: If you’re still experiencing problems (perhaps with RVM), try adding “/Applications/MAMP/Library/bin/” to your $PATH in “~/.bash_profile”.


You should probably follow the tutorial in this link. It is updated for MAMP 1.9.5 with mysql2. A couple of changes have been made to the new MAMP version.

http://blog.mirotin.net/?p=35

Furthermore the tar file you need can be found at this link. Download the MAMP_components_1.9.5.dmg file.

http://sourceforge.net/projects/mamp/files/mamp/1.9.5/


Finally got through this with this blog post: http://newfangled.me/installing-mamp-and-rails-on-a-mac/

Here's the archived version of that incase it goes offline http://web.archive.org/web/20130728130916/http://newfangled.me/installing-mamp-and-rails-on-a-mac

The other answer's reference 404s for me. http://blog.mirotin.net/?p=35 I'd been struggling with this for a while myself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜