[Mac] awk and tig are dyld: Library not loaded: Error in /usr/local/opt/readline/lib/libreadline.7.dylib
OS mac
Published : 2020-11-18   Lastmod : 2021-11-15

Cause

After uploading an image recognition library called dlib, when I try to use tig or awk, I get

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/awk
  Reason: image not found

The reason seems to be that during the dlib installation, cmake was upgraded and mac readline was upgraded from 7 to 8. tig and awk are not yet ready for readline 8, so the error seems to occur. As of November 2020, there is no problem with tig, but only with awk for now.

As of November 2020, there is no problem with tig. (It’s pretty frustrating when Shell bugs out…)

Solutions I’ve used before

When I had the same problem in the spring of 2019, I was able to solve it using the method shown here.

As described in “Pattern 2: I did a homebrew cleanup.

brew unlink readline
brew install cj-bc/cj-bc/readline

This was fixed by ``bash brew unlink readline brew install cj-bc/cj-bc/readline The cmake upgrade cleaned up and removed the readline7 series, so pattern 1 did not work this time.

The solution that worked this time.

I tried to run the same command again, but it didn’t fix the problem, and after some trial and error, the following worked.

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

You can find a lot of patterns and solutions for the cause of the problem, but this time I just reconfigured the symbolic links and it worked. I was up until 4am working on this one…

The following is the site that helped me.

Other sites that were helpful

Finally.

In my environment, various home-made scripts are running as resident assistants, and I get very impatient when a bash script that has been running without a hitch terminates with an error. I’ll leave this as a reminder so that I don’t have to work until 4 a.m. in the future. I hope this will be useful for those who encounter similar errors.

Related Articles