Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

做~自己de王妃 提交于 2019-12-02 15:01:27
Hawz

the error seems to be thrown when searching for /usr/local/opt/readline/lib/libreadline.7.dylib.

Have you tried to symlink that?

So something like:

cd /usr/local/opt/readline/lib 
ln -s libreadline.8.0.dylib libreadline.7.dylib

Just tried that on macOS Mojave, ruby 2.5.3p105 and Rails 5.2.2 and worked.

Reinstalling my Ruby version seems to have fixed it:

rvm reinstall 2.3.7

Yes, the best answer is to reinstall.

You can get the version easily by typing:

ruby -v

With rbenv, the command is i.e.:

rbenv install 2.3.7

with rvm:

rvm reinstall 2.3.7

can you try

cd /usr/local/opt/readline/lib    
ln -s libreadline.8.dylib libreadline.7.dylib

you are on the right track but it seems like rails is looking for libreadline.7.dylib and libreadline.7.dylib is not there in the folder.

Most often in Ruby-applications, this is caused by gems that have extensions (the gems saying "Building native extensions.."), that are built using a specific version of, in this case, readline.

Basically, there are two solutions:

Either, you can symlink version 8 of the gem, to the version missing. This will work in many cases, but if backwards compatibility is broken, it will not.

Or, if the gem actually supports version 8, you can reinstall that specific gem, or "pristine" it by running gem pristine --all.

EDIT: In scope of your "what I've tried", reinstalling PostgreSQL, is also one of the binaries, built using a specific version, that may also require a rebuild, to work with a system library, such as readline.

So Ive checked a few answers here but I dont think they can work with a vanilla Mojave mac install. Im using 10.14.4 while I did these:

  • get homebrew from https://brew.sh

  • $ brew install coreutils : this installs the gnu coreutils pkg for mac, we want the greadlink from this because macOSX's readlink is not the same as the gnu readlink. Its extremely confusing but such is the life in macland.

  • $ echo 'alias readlink=greadlink' >> ~/.bash_aliases I found macs readlink to be a bit lacking so I overrode the existing readlink by aliasing greadlink. (you can make this usable by all users by $ alias readlink=greadlink >> /etc/bashrc which will enable every user to be able to use it.

  • $ ln -s /usr/local/opt/readline/lib/libreadline.8.dylib /usr/local/opt/readline/lib/libreadline.7.dylib I linked the already linked .8. file instead of '.8.0.' file because if it were to get updated to .8.1. then my readlink wont break or miss features on the library. Im pretty sure we will format our macs before 9+ comes out.

I would recommend against manually symlink'ing native libraries. Aas of OS X 10.4, the standard include library path /usr/include is no longer used and is locked by SIP (making it difficult to move things to).

Apple ships a “legacy installer” for you to be able to install the headers in the “old location”, which will also resolve your path to correctly find headers installed via brew.

cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop && open ~/Desktop/macOS_SDK_headers_for_macOS_10.14.pkg`

See here for a detailed write-up on what is going on.

My problem was just the same when running lftp.

Just running brew upgrade has solved my problem, as it has updated (among others):

readline 8.0.0_1 -> 8.0.1
lftp 4.8.4 -> 4.8.4_2
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!