开发者

Ruby on Rails: How do I install the mysql gem on 10.6.7 Mac OS X (64bit)

开发者 https://www.devze.com 2023-03-16 03:51 出处:网络
There seem to be a bunch of blogs and instructions out there to do this, but I think a large issue with them is that they don\'t specify architecture.. they assume 32bit... which makes me sad =(

There seem to be a bunch of blogs and instructions out there to do this, but I think a large issue with them is that they don't specify architecture.. they assume 32bit... which makes me sad =(

Anyone know a good way to install the mysql connector / gem on 64bit snow leopard? Note: I already have mySQL, and it works just fine.

EDIT:

% sudo gem install mysql
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build ge开发者_C百科m native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb



Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

Edit # 2

 % sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql    

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


I found it. I hope this helps other people who are having issues:

export ARCHFLAGS="-arch x86_64" ; sudo gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config

got it from this article:

http://www.milindspandit.org/blog/?category_name=technical


I used macports to install mysql, which provides the necessary header files to compile the mysql gem using gem install mysql. I know my mysql installation is 64-bit (file /path/to/mysql reports Mach-O 64-bit executable x86_64). I assume the mysql gem is too. I hope this is what you're looking for.

0

精彩评论

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