LoginSignup
2
1

More than 3 years have passed since last update.

MongoDB didn’t work for openssl@1.1

Last updated at Posted at 2020-01-08

背景

opensslのバージョンを1.1にアップデートしたら、MongoDBが動かなくなりました。↓このようなエラーが出ました。

$ mongod --version                                                                   
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/opt/mongodb@3.2/bin/mongod
  Reason: image not found

念のため現在入っているopensslを確認

$ brew list openssl                                                                       
...
...
...
/usr/local/Cellar/openssl@1.1/1.1.1d/lib/libssl.1.1.dylib
...
...
...

解決方法

解決方法は2つあります。
1つ目は、opensslのバージョンを下げること
2つ目はmongodbバージョンを上げること

方法1 down the openssl version

brew update && brew upgrade
brew uninstall --ignore-dependencies openssl;brew uninstall --ignore-dependencies openssl;brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

バージョンが下がったことを確認

$ brew list openssl                                                                        
...
...
...
/usr/local/Cellar/openssl/1.0.2t/lib/libcrypto.1.0.0.dylib
...
...
...

MongoDBのバージョンを確認

$ mongod --version                                                                   
db version v3.2.21
git version: 1ab1010737145ba3761318508ff65ba74dfe8155
OpenSSL version: OpenSSL 1.0.2t  10 Sep 2019
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

方法2 upgrade MongoDB version

openssl@1.1であることを確認

$ brew list openssl                                                                       
...
...
...
/usr/local/Cellar/openssl@1.1/1.1.1d/lib/libcrypto.1.1.dylib
...
...
...

じゃなかったら、brew install openssl@1.1 を実行

$ brew upgrade mongodb                                                               
Error: No available formula with the name "mongodb"

おっと、Homebrew CoreからMongoDBが消えたからmongodbのバージョンはアップできないらしい。。。

しかし、↓これで解決できた!やったね!!

$ brew tap mongodb/brew
$ brew install mongodb-community@4.2

※注意
既存のmongodbパスを書き換えないと動かないです!!!!
なので、~/.zshrc(私の場合)にて、export PATH="/usr/local/opt/mongodb-community@4.2/bin:$PATH" を書き換えてください

mongodbバージョンを確認

$ mongod --version                                                                                      
db version v4.2.2
git version: a0bbbff6ada159e19298d37946ac8dc4b497eadf
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

ちゃんとバージョンアップされたのが確認できた!

感想

opensslのバージョンを下げてもMongoDBは使えますが、opensslに依存しているライブラリは同じdyld: Library not loaded:エラーが発生します。

なので、方法2の処理が妥当だと思います。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1