简体   繁体   中英

How to fix "dyld: Library not loaded" error when running composer?

I am on a bitnami MAMP stack. I am using the php shipped with MAMP as my default PHP installation.

I have installed composer using php scripts:

https://getcomposer.org/download/

Now whenever I type composer in my bash terminal, I get the following error:

dyld: Library not loaded: /bitnami/mampstackDev-osx-x64/output/common/lib/libcrypto.1.0.0.dylib
  Referenced from: /Applications/mampstack-7.1.15-0/php/bin/php.bin
  Reason: image not found

Seems to be some problem with loading of libcryptolib.

[UPDATE 03-12-2019] One comment i would like to add is that this problem is happening from the time i changed my default PHP installation from /usr/bin/php to Mampstack PHP. Once i reverted the default php installation it started working

The reason why this is happening is because neither Bitnami MAMP installer nor the use_mampstack startup script are setting the correct path to libraries, even though they are bundled and provided in ./common/lib directory (relative to your MAMP's installation path, for example /Applications/mampstack-7.2.29-2/ ).

To fix the issue, simply create symbolic links to libcrypto and libssl like this:

ln -s /Applications/mampstack-7.2.29-2/common/lib/libcrypto.1.1.dylib /usr/local/lib
ln -s /Applications/mampstack-7.2.29-2/common/lib/libssl.1.1.dylib /usr/local/lib

Of course, adjust library and MAMP stack version names to what you have installed on your system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM