0

I installed MySQL using Homebrew (brew install mysql), and then ran $ gem install mysql2 . I'm on a Mac running OSX 10.9.4.

I changed directories into the root of my app, and then try to run the rake db:migrate command, and got this error:

Levine_iMac$ rake db:migrate
rake aborted!
LoadError: dlopen(/Users/Levine_iMac/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
  Referenced from: /Users/Levine_iMac/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
  Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
 in /Users/Levine_iMac/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/Levine_iMac/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
/Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/application.rb:3:in require'
/Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/application.rb:3:in <top (required)>'
/Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/Rakefile:4:in <top (required)>'
(See full trace by running task with --trace)
Levine_iMac$

I tried adding something to my .bash_profile, as described here, but that did not work.

I tried a sudo command as described here, but that did not work.

I then tried updating my Ruby version from 2.1.1.. to 2.1.2.., and now I am getting this error when I run rake:db migrate

Levine_iMac$ rake db:migrate rake aborted! cannot load such file -- bundler/setup /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/boot.rb:4:in '<top (required)>' /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/application.rb:1:in '<top (required)>' /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/Rakefile:4:in '<top (required)>' (See full trace by running task with --trace) Levine_iMac$ bundle install rbenv: bundle: command not found The 'bundle' command exists in these Ruby versions: 2.1.1 Levine_iMac$

Any ideas on how to remedy this? Thanks.

Community
  • 1
  • 1
HPJAJ
  • 1,464
  • 2
  • 13
  • 18
  • I tried that. Now I am getting this error when I run rake:db migrate `Levine_iMac$ rake db:migrate rake aborted! cannot load such file -- bundler/setup /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/boot.rb:4:in '' /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/config/application.rb:1:in '' /Users/Levine_iMac/Dropbox/Coding/Sandbox/simple_cms2/Rakefile:4:in '' (See full trace by running task with --trace) Levine_iMac$ bundle install rbenv: bundle: command not found The 'bundle' command exists in these Ruby versions: 2.1.1` – HPJAJ Aug 28 '14 at 18:01
  • There is a clue in the last line: "command not found The 'bundle' command exists in these Ruby versions: 2.1.1". Try `gem install bundler` (required after upgrading ruby). – cydparser Aug 28 '14 at 20:09
  • That worked. Thanks @paulwise! And thanks to everyone else that contributed. – HPJAJ Aug 28 '14 at 20:42

1 Answers1

-1

Well, what are you exactly expecting to happen when you run rake db:migrate? Is some next step going to materialize for you? If you are able to answer this question, you will understand why what you're doing doesn't make sense.

I'll elaborate:

rake db:migrate only works in the context of an existing rails application. Running 'gem install mysql2' will get that library for you on your computer (this command is executed by itself, it doesn't actually have anything to do with Rails itself, or need a Rails app for context). So, there's no linear connection between the two.

  1. rails new myapp
  2. add 'gem mysql2' in the Gemfile
  3. bundle
  4. rake db:create

Or, alternatively:

rails new myapp -d mysql
ilrein
  • 3,833
  • 4
  • 31
  • 48
  • 1
    What has give you the impression he's not in an existing rails app? – JTG Aug 28 '14 at 17:52
  • It doesn't matter if he is or not, since 'gem install mysql2' is a command that has nothing to do with being in a Rails app, it just installs the library to your computer. Running rake db:migrate in his app, before and after installing mysql2, will output the same result. – ilrein Aug 28 '14 at 17:58
  • Hello. I do have an existing rails app that I have been working on on another computer. I installed everything on this computer, created the same named db, and need to migrate to populate it. This is where I am getting the error. I tried a recommendation above of installing Ruby again (which by the by, is an upgrade from 2.1.1.. to 2.1.2..). And now I am getting a new error (above). Thanks. – HPJAJ Aug 28 '14 at 18:07