Skip to content

Instantly share code, notes, and snippets.

@gmarik
Created October 20, 2010 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmarik/636865 to your computer and use it in GitHub Desktop.
Save gmarik/636865 to your computer and use it in GitHub Desktop.
worked for me
$ ARCHFLAGS="-arch i386 -arch x86_64" gem install -V mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
GET http://cdscm/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://gemcutter.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://gems.github.com/latest_specs.4.8.gz
304 Not Modified
Installing gem mysql-2.8.1
Downloading gem mysql-2.8.1.gem
GET http://gemcutter.org/gems/mysql-2.8.1.gem
302 Moved Temporarily
GET http://production.cf.rubygems.org/gems/mysql-2.8.1.gem
200 OK
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/COPYING
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/COPYING.ja
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/History.txt
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/Manifest.txt
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/README.txt
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/Rakefile
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/extra/README.html
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/extra/README_ja.html
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/extra/tommy.css
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/lib/mysql.rb
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/tasks/gem.rake
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/tasks/native.rake
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions. This could take a while...
/Users/mhratson/.rvm/rubies/ruby-1.8.7-p174/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile
make
gcc -I. -I. -I/Users/mhratson/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/i686-darwin9.8.0 -I. -DHAVE_MYSQL_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include/mysql -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common -g -O2 -fno-common -pipe -fno-common -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o mysql_api.bundle mysql.o -L. -L/Users/mhratson/.rvm/rubies/ruby-1.8.7-p174/lib -L. -lruby -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -ldl -lobjc
ld: warning: in /Users/mhratson/.rvm/rubies/ruby-1.8.7-p174/lib/libruby.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/mysql/lib/mysql/libmysqlclient.dylib, file was built for i386 which is not the architecture being linked (x86_64)
make install
/usr/bin/install -c -m 0755 mysql_api.bundle /Users/mhratson/.rvm/gems/ruby-1.8.7-p174/gems/mysql-2.8.1/lib
Successfully installed mysql-2.8.1
1 gem installed
# http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/
# http://stackoverflow.com/questions/5446747/ruby-mysql2-gem-not-working-mac-os-x-snow-leopard-ruby-1-9-2
~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': dlopen(~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle
Reason: image not found - ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2.rb:9:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `each'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `block in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `each'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler.rb:128:in `require'
from ~/src/napp/config/application.rb:8:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
app$ export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
#and it worked
~/.rvm/gems/ruby-1.8.7-p174/gems/nokogiri-1.4.3.1/lib/nokogiri/nokogiri.bundle: dlopen(~/.rvm/gems/ruby-1.8.7-p174/gems/nokogiri-1.4.3.1/lib/nokogiri/nokogiri.bundle, 9): no suitable image found. Did find: (LoadError)
~/.rvm/gems/ruby-1.8.7-p174/gems/nokogiri-1.4.3.1/lib/nokogiri/nokogiri.bundle: mach-o, but wrong architecture - ~/.rvm/gems/ruby-1.8.7-p174/gems/nokogiri-1.4.3.1/lib/nokogiri/nokogiri.bundle
from ~/.rvm/gems/ruby-1.8.7-p174/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/nokogiri-1.4.3.1/lib/nokogiri.rb:13
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
from ~/src/panda/spec/../config/boot.rb:114:in `load_gems'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rails-2.3.8/lib/initializer.rb:164:in `process'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
from ~/src/panda/spec/../config/environment.rb:9
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ~/src/panda/spec/spec_helper_prefork.rb:28
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ~/src/panda/spec/spec_helper.rb:8
from ~/.rvm/gems/ruby-1.8.7-p174/gems/spork-0.8.4/lib/spork.rb:23:in `prefork'
from ~/src/panda/spec/spec_helper.rb:4
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from ~/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ~/src/panda/spec/models/reports/product_selling_price_report_spec.rb:1
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `load'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `load_files'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `each'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
from ~/.rvm/gems/ruby-1.8.7-p174/gems/rspec-1.3.0/bin/spec:5
$ ARCHFLAGS="-arch i386 -arch x86_64" gem inst nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.3.1
1 gem installed
$ ./script/console
Loading development environment (Rails 2.3.8)
Missing rcov. Skipped
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Users/mhratson/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Users/mhratson/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
Trace/BPT trap
$ gem install -V mysql
GET http://cdscm/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://gemcutter.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://gems.github.com/latest_specs.4.8.gz
304 Not Modified
Installing gem mysql-2.8.1
Downloading gem mysql-2.8.1.gem
GET http://rubygems.org/gems/mysql-2.8.1.gem
302 Moved Temporarily
GET http://production.cf.rubygems.org/gems/mysql-2.8.1.gem
200 OK
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/COPYING
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/COPYING.ja
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/History.txt
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/Manifest.txt
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/README.txt
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/Rakefile
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/ext/mysql_api/mysql.c
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/extra/README.html
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/extra/README_ja.html
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/extra/tommy.css
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/lib/mysql.rb
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/tasks/gem.rake
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/tasks/native.rake
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/tasks/vendor_mysql.rake
~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions. This could take a while...
~/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... yes
checking for mysql.h... yes
creating Makefile
make
gcc -I. -I. -I~/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin10.4.0 -I. -DHAVE_RB_STR_SET_LEN -DHAVE_RB_THREAD_START_TIMER -DHAVE_MYSQL_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include/mysql -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common -g -O2 -fno-common -pipe -fno-common -c mysql.c
mysql.c: In function ‘time_inspect’:
mysql.c:1791: warning: format ‘%04d’ expects type ‘int’, but argument 5 has type ‘long int’
mysql.c:1791: warning: format ‘%02d’ expects type ‘int’, but argument 6 has type ‘long int’
mysql.c:1791: warning: format ‘%02d’ expects type ‘int’, but argument 7 has type ‘long int’
mysql.c:1791: warning: format ‘%02d’ expects type ‘int’, but argument 8 has type ‘long int’
mysql.c:1791: warning: format ‘%02d’ expects type ‘int’, but argument 9 has type ‘long int’
mysql.c:1791: warning: format ‘%02d’ expects type ‘int’, but argument 10 has type ‘long int’
mysql.c: In function ‘time_to_s’:
mysql.c:1804: warning: format ‘%04d’ expects type ‘int’, but argument 5 has type ‘long int’
mysql.c:1804: warning: format ‘%02d’ expects type ‘int’, but argument 6 has type ‘long int’
mysql.c:1804: warning: format ‘%02d’ expects type ‘int’, but argument 7 has type ‘long int’
mysql.c:1804: warning: format ‘%02d’ expects type ‘int’, but argument 8 has type ‘long int’
mysql.c:1804: warning: format ‘%02d’ expects type ‘int’, but argument 9 has type ‘long int’
mysql.c:1804: warning: format ‘%02d’ expects type ‘int’, but argument 10 has type ‘long int’
cc -dynamic -bundle -undefined suppress -flat_namespace -o mysql_api.bundle mysql.o -L. -L~/.rvm/rubies/ruby-1.8.7-p302/lib -L. -lruby -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -ldl -lobjc
ld: warning: in /usr/local/mysql/lib/mysql/libmysqlclient.dylib, file was built for i386 which is not the architecture being linked (x86_64)
make install
/usr/bin/install -c -m 0755 mysql_api.bundle ~/.rvm/gems/ruby-1.8.7-p302/gems/mysql-2.8.1/lib
Successfully installed mysql-2.8.1
1 gem installed
/
sudo brew install mysql
==> Downloading ftp://ftp.cwru.edu/pub/bash/readline-6.1.tar.gz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file complete.c
patching file patchlevel
patching file readline.h
patching file patchlevel
==> ./configure --prefix=/usr/local/Cellar/readline/6.1 --mandir=/usr/local/Cellar/readline/6.1/share/man --infodir=/usr/local/Cellar/readline/6.1/share/info --enable-multibyte
==> make install
==> Caveats
readline is keg-only. This means it is not symlinked into Homebrew's
prefix. The formula provides the following rationale:
OS X provides the BSD Readline library. In order to prevent conflicts when
programs look for libreadline we are defaulting this GNU Readline installation
to keg-only.
Generally there are no consequences of this for you, however if you build your
own software and it requires this formula, you may want to run this command to
link it into the Homebrew prefix:
brew link readline
==> Summary
/usr/local/Cellar/readline/6.1: 32 files, 2.0M, built in 37 seconds
==> Downloading http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz
######################################################################## 100.0%
==> Downloading patches
==> Patching
patching file scripts/mysqld_safe.sh
Hunk #1 succeeded at 384 (offset 1 line).
patching file scripts/mysql_config.sh
==> ./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql/5.1.51 --localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/e
==> make install
==> Caveats
Set up databases with:
mysql_install_db
If this is your first install, automatically load on login with:
cp /usr/local/Cellar/mysql/5.1.51/com.mysql.mysqld.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
If this is an upgrade and you already have the com.mysql.mysqld.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
cp /usr/local/Cellar/mysql/5.1.51/com.mysql.mysqld.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
Note on upgrading:
We overwrite any existing com.mysql.mysqld.plist in ~/Library/LaunchAgents
if we are upgrading because previous versions of this brew created the
plist with a version specific program argument.
Or start manually with:
mysql.server start
==> Summary
/usr/local/Cellar/mysql/5.1.51: 220 files, 45M, built in 9.7 minutes
13:48 master\panda$ which mysql
/usr/local/bin/mysql
13:49 master\panda$ gem uni mysql
Successfully uninstalled mysql-2.8.1
13:49 master\panda$ gem inst mysql
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
@gmarik
Copy link
Author

gmarik commented Oct 20, 2010

with homebrew and google ti's much easier!

@gmarik
Copy link
Author

gmarik commented Jun 15, 2011

on a new Snow Leo x86_64 using mysql-5.5.dmg installed db had to do this:
$ ln -f -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/

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