Linking against GNU readline on Mac M1

·

1 min read

brew install readline
brew link --force readline
sudo cpanm Term::ReadLine::Gnu
brew unlink readline

Note that on ARM architecture the homebrew binaries were moved to /opt/homebrew in contrast to the /usr/local on x86, so the LDFLAGS and CPPFLAGS should be like this:

LDFLAGS="-L/opt/homebrew/opt/readline/lib" CPPFLAGS="-I/opt/homebrew/opt/readline/include"

Links:

https://blogs.perl.org/users/aristotle/2013/07/easy-osx-termreadlinegnu.html

https://www.reddit.com/r/MacOS/comments/jw9guu/why_did_homebrew_move_from_usrlocalto_opthomebrew/?rdt=59385