phpenvでインストール:configure: error: Cannot find libz
インストール環境
OS
macOS Catalina version 10.15.3
Error
$ phpenv install 7.1.19 [Info]: Loaded extension plugin [Info]: Loaded apc Plugin. [Info]: Loaded composer Plugin. [Info]: Loaded github Plugin. [Info]: Loaded uprofiler Plugin. [Info]: Loaded xdebug Plugin. [Info]: Loaded xhprof Plugin. [Info]: Loaded zendopcache Plugin. [Info]: php.ini-production gets used as php.ini [Info]: Building 7.1.19 into /Users/******/.anyenv/envs/phpenv/versions/7.1.19 [Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.1.19.tar.bz2 [Preparing]: /var/tmp/php-build/source/7.1.19 ----------------- | BUILD ERROR | ----------------- Here are the last 10 lines from the log: ----------------------------------------- configure: error: Cannot find libz ----------------------------------------- The full Log is available at '/tmp/php-build.7.1.19.20200227165241.log'. [Warn]: Aborting build.
解決
$ brew install autoconf bison bzip2 curl icu4c libedit libjpeg libiconv libpng libxml2 libzip openssl re2c tidy-html5 zlib $ CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-bz2=$(brew --prefix bzip2) --with-curl=$(brew --prefix curl) --with-iconv=$(brew --prefix libiconv) --with-libedit=$(brew --prefix libedit) --with-readline=$(brew --prefix readline) --with-tidy=$(brew --prefix tidy-html5)" phpenv install [version]
環境変数等をまとめて「phpenv install [version]」だけ出来る方法がまだ見つからない状態です。