0

I am new to Ruby on rails, so I was following the instructions to install ROR from gorails.com, with mysql as database. (Have also tried using SQLite3, but I am getting an error there as well...?) https://gorails.com/setup/osx/10.14-mojave

Everything went well until I had to use following,

rake db:create

When I run this command inside my ROR project, I get this rake aborted error. With following output from my terminal.

rake aborted!
LoadError: dlopen(/Users/username/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Users/username/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/username/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle
/Users/username/Desktop/myapp3/config/application.rb:7:in `<top (required)>'
/Users/username/Desktop/myapp3/Rakefile:4:in `require_relative'
/Users/username/Desktop/myapp3/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

I have tried to check the gemfile.

ray
  • 5,454
  • 1
  • 18
  • 40
hurlen
  • 11
  • 1

2 Answers2

1

I used the answers from @Denny Mueller and @Umar Khan to fix the problem. I did not realise it was a problem with the openssl, but the solution to the problem is the same as the answer provided by Michael Erb on this question.

The Solution

As it turns out, openssl is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own libs. Firstly, uninstall mysql2.

gem uninstall mysql2

Then reinstall OpenSSL

brew reinstall openssl

Notice the output containing:

LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

Then we can install mysql2 again

gem install mysql2 -v 0.4.10 -- --with-cppflags=-`I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib`
hurlen
  • 11
  • 1
0

Try this:

brew install openssl

cd /usr/local/Cellar/openssl/1.0.1f/lib

sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/lib/

You can find a full solution here - https://mithun.co/hacks/library-not-loaded-libcrypto-1-0-0-dylib-issue-in-mac/

Umar Khan
  • 1,381
  • 11
  • 18
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/22343407) – Jondiedoop Mar 01 '19 at 11:28
  • @Jondiedoop I believe now it deserve upvote not downvote :) – Umar Khan Mar 01 '19 at 12:09
  • I wasnt the downvoter. So i can not retract it. I do not consider myself experienced enough in ruby to judge whether it deserves an upvote, but the community does. Dont worry. – Jondiedoop Mar 01 '19 at 12:13