I’m trying to install the mysql gem v. 2.7 on MacOsX Snow Leopard.
I know a lot has been written about this, and I’ve read most of it.
If I do the following:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -v '2.7' -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I get:
ERROR: While executing gem ... (TypeError)
can't dup NilClass
Instead, trying to install v 2.8 works fine:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...
But then I get this error when trying to start my local server:
=> Booting WEBrick
=> Rails 2.3.6 application starting on http://0.0.0.0:3000
/Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant MysqlCompat::MysqlRes (NameError)
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:80:in `const_missing'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/mysql_adapter.rb:9:in `define_all_hashes_method!'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/mysql_adapter.rb:68:in `mysql_connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activerecord-2.3.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
from /Users/phishman/Sites/BlindDog/vendor/plugins/admin_data/lib/admin_data/settings.rb:65:in `initialize_defaults'
from /Users/phishman/Sites/BlindDog/vendor/plugins/admin_data/init.rb:36:in `evaluate_init_rb'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin.rb:158:in `evaluate_init_rb'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin.rb:154:in `evaluate_init_rb'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin.rb:48:in `load'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin/loader.rb:38:in `load_plugins'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin/loader.rb:37:in `each'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/rails/plugin/loader.rb:37:in `load_plugins'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/initializer.rb:369:in `load_plugins'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/initializer.rb:165:in `process'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/initializer.rb:113:in `send'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/initializer.rb:113:in `run'
from /Users/phishman/Sites/BlindDog/config/environment.rb:9
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:156:in `require'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:156:in `require'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/activesupport-2.3.6/lib/active_support/dependencies.rb:156:in `require'
from /Users/phishman/Sites/BlindDog/vendor/ruby/1.8/gems/rails-2.3.6/lib/commands/server.rb:84
from script/server:3:in `require'
from script/server:3
Can you help me? Please, I’ve been breaking my head on this for 2 days 🙁
MySQL I’m using is the dmg downloaded from mysql.com. I even tried to uninstall it and install mysql from macports but getting lots of errors, so I had to re-install from mysql.com
Found the way to install mysql gem and make it work:
I installed rvm, istalled ruby 1.8.7 and made it the defualt ruby (instead of the system one), then I compiled and reinstalled all the gems using
Now it works!