I just upgraded to Mac OSX Snow Leopard, and recompiled mysql (5.1.39) with the Snow Leopard XCode. I also reinstalled the latest mysql gem.
Now, when running
rake db:migrate
in a rails app, I get
dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found
Trace/BPT trap
I have /usr/local/mysql/lib/libmysqlclient.16.dylib, but not ...15.dylib.
Do I need to use an earlier version of mysql?
No it almost looks like you need to remove the mysql gem and then re-install it using
gem install mysql -- --with-mysql-dir=/path/to/mysql_dir (sometimes /usr/local/mysql)
Try hammering in which version of mysql for the gem to use:
gem install mysql -- --with-mysql-config=/path/to/mysql_config
Thanks for the help!
I ended up removing mysql completely:
http://akrabat.com/2008/09/11/uninstalling-mysql-on-mac-os-x-leopard/
Then compiling and installing the following to /usr/local:
readline 6.0
ruby 1.8.7
rubygems
With help from
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard
Related
Im newbie starting to learn ruby/rails. While i was trying to setup WeBRICK to run, an error related to the libmysql.dll appeared, so ive downloaded an dll from an older version of mysql and tried again, but the error kept. Then i read that the problem was that my computer is 64bit and the gem mysql2 installed apparently is 32bit, that way i uninstalled that gem and tried to do the following workaround:
1) download mysql connector 32 bits
2) gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
the problem now is that im getting the following error:
ERROR: While executing gem ... (Errno::EEXIST)
File exists - C:
So, now i cant even install the mysql2 gem
Can you guys help me please?
It's not recommended to run ruby on rails on windows. mac or linux will be better.
if you can't change your OS. you can try this:
http://eric.cloud-mes.com/2012/04/1/install-Ruby-1.9.3-and-Rails-3.2.3-on-Windows-7.html
Ruby already installed on Mac. So i just installed rails.
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
rails 2.3.11
gem 1.3.5
When i trying : gem install mysql i get this error:
89-235-235-64:~ vitali$ gem install mysql
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/vitali/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
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
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
89-235-235-64:~ vitali$
Dont understand what to do. gem install mysql installing without MySQl itself or I should download and install MySQL as prorgamm? If yes, from what resource, what version, how to instal? Please help me, im newbie on mac. Big thanks!
You're almost certainly going to need MySQL installed to have the MySQL gem installed (even better is the mysql2 gem, which Rails also works with - just use mysql2 instead of mysql in your database.yml file).
I find the best way to get MySQL on my Mac whenever I format it (which, admittedly, is rarely) is to use Homebrew. So, if you don't have Homebrew installed, I'd start with that... and once that's done, it should be a matter of running sudo brew install mysql, and running the instructions it provides after the installation is done.
I have working fine my installation of Ruby on Rails on my Snow Leopard. I've tried for several days install MySQL with Ruby on Rails, all I've got when I run:
rake db:create
is:
(in /Users/naikon/RoR/test2)
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.4/ext/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.4/ext/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap
I've tried with MySQL 32 and 64 bits (and deleting all several times), install mysql gem in all the ways I've found on the internet, including
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I'm lost, frustrated and I really appreciate some help.
Thanks.
Well lets start off with the fact your building the incorrect gem.
From your error report it appears your using Rails 3, and this doesn't use the "mysql" gem at all. It uses the mysql2 gem which offers a number of performance features.
You can read more about the mysql2 gem at http://github.com/brianmario/mysql2
I think you will be fine once you install the correct gem. =)
I have updated to rails 3 on my Snow leopard. Previously i use sqlite for development.
It's working fine when i rake db:create.
Now I'm trying to install mysql on my mac.
I downloaded mysql-5.1.50-osx10.6-x86.dmg
Installed all three file.(mysql-{version}-osx10.5-x86.pkg, MySQL.prefPane, MySQLStartupItem.pkg)
execute this to install gem.
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
Everything is good. gem created with no error.
I create new project with rails new p1 -d mysql
Proceed with
rake db:create
it shows
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
Then I install new gem. sudo gem install mysql2.
same problem. i got
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap
I deleted the duplicate mysql2.bundle. The result is same. error.
i have read almost all articles on the net. But could solve this problem.
Is it because i installed 32 bit mysql on snow leopard? or my rubygems problem?
Why rails 3 suddenly asking for mysql2 gem since i use '-d mysql'.
Rails 3 + MySql on mac
Thank you. Have a nice day.
Rails switched to mysql2, see wycat's blog.
i did multiple try and error with
mysql-5.1.50-osx10.6-x86
mysql-5.1.50-osx10.6-x86_64
I received mysql.prefpane and dyld: lazy symbol binding failed: Symbol not found: _mysql_init problem.
Then I found a post at http://weblog.rubyonrails.org/.
It says i need to install
mysql-5.1.50-osx10.5-x86_64
works better. solved both problem. but still got errno: 2. Which i can't create database.
Solved errno:2 by REBOOT the system.
Try to install http://rubygems.org/gems/ruby-mysql
We struggled with this for about two hours, reinstalled mysql a couple times, and eventually solved our problem with an "rvm implode" and subsequent reinstall of rvm. This deletes everything under .rvm, so be careful, but if you're using rvm, it's worth a shot.
I have a rails environment which I set-up with macports. I recently updated macports which seems to have had the side effect of breaking rails. When I try to boot a rails server I get:
$ ./script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle: dlopen(/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle, 9): Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient.15.dylib (LoadError)
Referenced from: /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
Reason: image not found - /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
I've tried reinstalling the mysql gem many times using various configurations I've found around the web but nothing seems to help. Also, when I try to use rake I get:
rake db:migrate
Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Pleasegem update --systemand try again.
Even though:
gem --version
1.3.6
What's going on here?
It seems the problem was that I had rails installed under macports, and also as a gem. I uninstalled all the rails components from macports and just stuck with the gems version and it seems to have made the MySQL problem go away.