Homebrew pyenv install error dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Asked Answered
H

2

6

After installing pyenv from Homebrew on MacOS Mojave I am getting build errors when attempting to install any python versions.

When running pyenv install for any version the build will fail with error:

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/awk
  Reason: image not found
Hak answered 20/2, 2019 at 0:25 Comment(0)
F
7
ln -sf /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Fukuoka answered 27/2, 2019 at 9:4 Comment(1)
Be careful using the the force flag -f as it could overwrite a working install. If you get an error with -s. Try checking what the link is pointing to with ls -l before overwriting it.Hak
H
5

The solution for me was to force link the readline 8 lib that I had under /usr/local/opt/readline/lib/.

> cd /usr/local/opt/readline/lib/
> ls
libhistory.8.0.dylib  libhistory.a          libreadline.8.dylib   libreadline.dylib
libhistory.8.dylib    libhistory.dylib      libreadline.8.0.dylib libreadline.a         pkgconfig

Since I have a newer version of the readline lib, I tried to force it to find the one I have by symlinking it to the filename it was looking for. e.g.

> cd /usr/local/opt/readline/lib/
> ln -s libreadline.8.0.dylib libreadline.7.dylib
> ls
libhistory.8.0.dylib  libhistory.a          libreadline.7.dylib   libreadline.8.dylib   libreadline.dylib
libhistory.8.dylib    libhistory.dylib      libreadline.8.0.dylib libreadline.a         pkgconfig

pyenv install x.y.z should now be working (or at least throw a different error ;).

Hak answered 20/2, 2019 at 0:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.