Skip to content

Instantly share code, notes, and snippets.

@kneipp
Created May 23, 2011 19:36
Show Gist options
  • Save kneipp/987388 to your computer and use it in GitHub Desktop.
Save kneipp/987388 to your computer and use it in GitHub Desktop.
Instalação gem mysql2 no OS X 10.6.7
Passos que segui para conseguir instalar a gem mysql2,
pois o comando de forma tradicional gem install mysql2 não estava funcionando.
1) locate mysql_config
Não listava nada, porém tenho mysql rodando aqui com PHP.
2) brew install mysql
3) locate mysql_config
/Applications/MAMP/Library/bin/mysql_config
/usr/local/mysql-5.1.53-osx10.6-x86/bin/mysql_config
4) gem install mysql2 -- –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
@kneipp
Copy link
Author

kneipp commented May 23, 2011

Segue erro abaixo:
Gemset rails3:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
too many bad responses (http://rubygems.org/gems/mysql2-0.3.2.gem)

Gemset global:
~/Projects ruby-1.9.2 $ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

    /Users/fabricio/.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/fabricio/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.7.0 -I/Users/fabricio/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/fabricio/.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/fabricio/.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/fabricio/.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/fabricio/.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/fabricio/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/intern.h:29,
from /Users/fabricio/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:1327,
from /Users/fabricio/.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/fabricio/.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
client.c: In function ‘rb_mysql_client_escape’:
client.c:174: warning: unused parameter ‘klass’
make: *** [client.o] Error 1

Gem files will remain installed in /Users/fabricio/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2 for inspection.
Results logged to /Users/fabricio/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/ext/mysql2/gem_make.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment