2011-04-20 15 views
2

我试图使用Ruby与MAMP自带的MySQL,但是没有安装头文件(或类似的东西)时出现问题。使用MAMP为Ruby设置MySQL

有人提到我复制下面的教程,但我无法让它工作。当我把第一行放入./configure时,它说没有这样的目录。

1)特别的一个问题是,它说,“copy the MySQL source file (mysql-5.1.37.tar.gz) to somewhere on your hard drive.”我不知道是否通过安装MAMP我已经完成了这一步。如果不是,那么我不知道该怎么做。

2)我也不知道当它说“解开”源文件和“cd”时它是什么意思......如果安装了MAMP,它已经解开了吗?

3)另外,不要将我只要打开终端,启动这个代码,还是我去到MySQL?

我想知道有没有人能告诉我如何去适应它。这里有两个关于我的安装的信息可能会有所帮助。 a)。

a)。 MySQL在我的电脑上设置在8889端口上。 b)还当我输入“mysql的这”在命令行中,它响应“的/ usr /本地/ MySQL的/斌/ MySQL的。”

如果可以请帮帮忙。谢谢。

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/Library 

$ 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”. 

回答

1

您应该按照本教程中的链接。它使用mysql2更新为MAMP 1.9.5。新的MAMP版本已经做了一些改变。

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

而且您需要的tar文件可以在此链接上找到。下载MAMP_components_1.9.5.dmg文件。

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

+0

感谢的建议,但本教程不会为我工作。我做了关于我的问题,另外一个问题http://stackoverflow.com/questions/5738997/sudo-port-command-not-found-setting-up-ruby-with-mysql-mamp – Leahcim 2011-04-21 21:59:11