- Blog
- Howtos
- anything generator
- apache
- asterisk
- autofs
- autoload
- automount
- backup db
- callcentric
- centos
- chumby
- cipher list
- cookies
- ctags
- dns
- dovecot
- glue fleece
- hacking
- httpd
- IE
- iFrame
- ip
- ispconfig
- javascript
- lighttpd
- linux
- media player
- move networks
- mysql
- mysqldiff
- mythtv
- Network Solutions
- openssl
- osx
- os x
- P3P Compact Policy
- php
- postfix
- proftpd
- proxy
- python
- route
- ruby
- screen scraping
- shell
- shell scripts
- slapd
- smb
- ssh
- sshfs
- SSLCertificateChainFile
- sslv2
- stunnel
- suphp
- taglist
- telnet
- trace
- verisign
- vi
- vsftpd
- Scripts
- About
gem install mysql OS X
Submitted by adam on Sun, 2008-11-23 02:17.
After having trouble installing mysql support for python, I ran into similar problems with ruby. To fix, first I installed a new version of MySQL from mysql.com. I'm not sure if this is necessary since OS X comes with MySQL but I don't have a second box to test with. After running the install, pick one of the lines below that matches the version you installed.
MySQL x86:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ --with-mysql-include=/usr/local/mysql/include \ --with-mysql-lib=/usr/local/mysql/lib
MySQL x86_64:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- \ --with-mysql-include=/usr/local/mysql/include \ --with-mysql-lib=/usr/local/mysql/lib
* I had problems using the x86_64 version because ruby is only compiled as 32-bit

What worked for me (from sudo shell)
>env ARCHFLAGS="-arch i386"
>gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
gem install mysql (ON PPC)
i spent 4 hours trying to find this answer. I ran the commands for PPC
sudo env ARCHFLAGS="-arch ppc"
and
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
and it worked!!! THANK YOU!!!!!
for all those googling this .. i got the following error.. supplying lib directories and mysql directories didn't work...
g4-15:mysql-2.7 user$ sudo gem install 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
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
thanks again.
andy.