8

i was previously trying to make a new rails backend for an app. when i tried to cd into the app, terminal stated: rvm install "ruby-2.6.5"

when i tried to install that, i got an error:

Error running '__rvm_make -j8',

so, i am trying to switch to another app that was previously working that has rails as the backend.

i have two ruby versions installed: 2.3.7 and 2.6.1 - 2.6.1 is the current version.

i'm trying to run the rails server, and when i do - the following error in the terminal is what i get:

    57: from bin/rails:3:in `<main>'
    56: from bin/rails:3:in `load'
    55: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/spring:15:in `<top (required)>'
    54: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/spring:15:in `require'
    53: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    52: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    51: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    50: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    49: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    48: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    47: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    46: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/bin/rails:9:in `<top (required)>'
    45: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
    44: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
    43: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
    42: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    41: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    40: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    39: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    38: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    37: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
    36: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
    35: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
    34: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    33: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    32: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    31: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
    30: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
    29: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:141:in `block in perform'
    28: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
    27: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
    26: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
    25: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    24: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    23: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    22: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    21: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    20: from /Users/yoyotoo/Desktop/flatiron/pets/pets_backend/config/application.rb:7:in `<main>'
    19: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler.rb:114:in `require'
    18: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require'
    17: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each'
    16: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require'
    15: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each'
    14: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
    13: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    12: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    11: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    10: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
     9: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
     8: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg.rb:4:in `<main>'
     7: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
     6: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
     5: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
     4: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
     3: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
     2: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     1: from /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': dlopen(/Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib
  Reason: image not found - /Users/yoyotoo/.rvm/gems/ruby-2.6.1/gems/pg-1.1.4/lib/pg_ext.bundle```

please help! thanks!


Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56
cynthia7117
  • 121
  • 1
  • 1
  • 5
  • At a glance, you need to `brew install` openssl and postgresql and then reinstall the pg gem. – anothermh Jan 24 '20 at 22:26
  • thanks! didn't work though ;( both openssl and postgresql were reinstalled and then i installed the pg gem. – cynthia7117 Jan 24 '20 at 22:36
  • How did you reinstall pg? Did you gem uninstall/gem install, or did you gem uninstall and then bundle install? It should be done through bundle install. – anothermh Jan 24 '20 at 22:55
  • thank you!!! yup, bundle install worked. if you have time/don't mind, could you please explain the terminal errors and how you knew what to do? – cynthia7117 Jan 24 '20 at 23:28
  • `gem uninstall`/`gem install` deals with global gems, `bundle install` deals with installing and referencing gems for your specific app. Looking at the last line of your file, it says that there is a problem with `pg-1.1.4` indicating something wrong with referencing the correct `pg` gem. – Matthew Jan 25 '20 at 02:21
  • @cynthia7117 It's the last three lines: `pg-1.1.4/lib/pg_ext.bundle` can't load `libssl.1.0.0.dylib`. So you install OpenSSL to make `libssl.1.0.0.dylib` available, then you uninstall pg and reinstall it so it compiles with the currently installed version of OpenSSL, and you do the pg installation via `bundle install` so you know the correct version of pg required by your application gets installed. – anothermh Jan 25 '20 at 04:40
  • See similar discussion at https://stackoverflow.com/questions/59006602/dyld-library-not-loaded-usr-local-opt-openssl-lib-libssl-1-0-0-dylib/60068011#60068011 which led me to find a solution. – Greg Feb 05 '20 at 02:01

6 Answers6

28

In case someone else runs into this error like I just did, here's what worked for me:

ln -s /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

After that everything ran fine. I'm guessing the library is referencing some old dylib file and is OK with the newer one installed on your system.

Jay El-Kaake
  • 618
  • 6
  • 11
  • 1
    Very useful. Thank you @Jay El-Kaake – Jefferson Bien-Aime Sep 03 '20 at 01:41
  • 1
    Genius! Your solution worked like a charm, Many thanks! I would like to know how you reached this solution. I mean why I'm just a copy paster of such solutions :) What should I read to be able to find such solutions even they are not available on SO. – Ramesh Pareek Oct 14 '20 at 16:26
  • 4
    Dirty. Works until something will be missing in the lib `dyld: Symbol not found: _SSL_library_init` – A.D. Oct 17 '20 at 13:43
4

For me I had to

brew uninstall postgres
brew install postgres

gem uninstall pg
bundle install
hrdwdmrbl
  • 4,814
  • 2
  • 32
  • 41
3

For me, just installing appropriate version of openssl worked.

brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Reference: https://github.com/kelaberetiv/TagUI/issues/86

mdaftab88
  • 291
  • 3
  • 8
  • 3
    Calling Non-checksummed download of openssl formula file from an arbitrary URL is disabled! Use 'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead. – AlxVallejo Oct 30 '20 at 12:39
  • 1
    You can't brew install directly from GitHub as noted by @AlxVallejo - follow the instructions here to install using this method - https://github.com/tebelorg/Tump/issues/1#issuecomment-701530062 – D W Nov 17 '20 at 13:45
1

For version openssl@3

you can try this

brew reinstall openssl@3

and then

brew unlink openssl@3 && brew link openssl@3
Hasan Ahamed
  • 186
  • 3
  • 6
0

I have openssl1.1 installed on my system, but the rails is somehow using the old reference i.e /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) but this doesn't exist on my Mojave 14.

I tried the below solutions but no luck:

  1. brew switch openssl 1.0.2t (Error: Unknown command: switch)
  2. reintalling openssl
  3. downgrade the version of openssl to 1.0
  4. Reintalling rvm and ruby

Finally, below solution works:

cp /usr/local/opt/openssl/lib/libssl.1.1.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
cp /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

Just copy the new openssl link to the old ones

Chakreshwar Sharma
  • 2,571
  • 1
  • 11
  • 35
0

In my case (macOS 12.6.5, ruby 2.0.0), I have to upgrade my ruby version to 3.0.0 to make the openssl compatible. After upgrade, I can run gem update/install without issue.

Regarding the ruby version, I referred to this post on GitHub.

wzso
  • 3,482
  • 5
  • 27
  • 48