Mac Rails gem安装mysql2失败

Mac Rails gem安装mysql2失败,mysql,ruby-on-rails,ruby,macos,Mysql,Ruby On Rails,Ruby,Macos,我的Mac OS X版本是10.6.6 Ruby版本是1.9.2 Rails版本是3.1 请注意,我以前安装过MAMP。 键入gem install mysql2时,会显示一条消息: yeung-catoteki-iMac:~ catoyeung$ gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to

我的Mac OS X版本是10.6.6 Ruby版本是1.9.2 Rails版本是3.1 请注意,我以前安装过MAMP。 键入gem install mysql2时,会显示一条消息:

yeung-catoteki-iMac:~ catoyeung$ gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.

    /Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
gcc -I. -I/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.4.0 -I/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/mysql/include  -g -Os -arch i386 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe -Wall -funroll-loops  -o client.o -c client.c
In file included from /Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
             from ./mysql2_ext.h:8,
             from client.c:1:
/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:108: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/intern.h:29,
             from /Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:1327,
             from /Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
             from ./mysql2_ext.h:8,
             from client.c:1:
/Users/catoyeung/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/st.h:69: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
make: *** [client.o] Error 1


Gem files will remain installed in /Users/catoyeung/.rvm/gems/ruby-1.9.2-        p180@rails3_1/gems/mysql2-0.3.7 for inspection.
Results logged to /Users/catoyeung/.rvm/gems/ruby-1.9.2-p180@rails3_1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
似乎它无法生成makefile。
专家们,请帮助。

如果您还没有安装Xcode,您将需要安装Xcode。

这有安装mysql所需的步骤。

使用查询
mysql gem错误:数组'st\u check\u for_sizeof_st\u index\u t'的大小为负。
我检查了MAMP。其软件包应包括32位和64位版本。此外,我的错误信息与您网站上的不同。而且,我担心网站中使用的方法会破坏我的MAMP安装,所以我没有尝试过。