How can I install zlib on Mac OS X Mojave (10.14)?
Solution 1
https://github.com/pyenv/pyenv/issues/1219
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Solution 2
It helped me as well, answer is here: https://github.com/Homebrew/homebrew-core/issues/29176 More details, this works:
brew update
-
(Re)Install CLT.
installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew reinstall python@2
Solution 3
I needed an extra step to get it running on Mojave 10.14.05, Python 3.7. First:
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.6/bin"
then
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
see this post.
geoidesic
Updated on June 06, 2022Comments
-
geoidesic almost 2 years
I recently upgraded from Sierra to Mojave. After that I tried to use
pyenv install 3.5.6
. This uses homebrew in the background to try to install python, which fails withzipimport.ZipImportError: can't decompress data; zlib not available
. The same command worked before the upgrade.This question has been asked before and the generally accepted solution is to install xcode command line tools using this command:
xcode-select --install
.I have both xcode 10 and the command line tools installed but zlib is still unavailable.
I tried installing zlib using homebrew but that didn't work either.
(Incidentally I also looked into installing python from a binary but there's no v3.5.6 binary for Mac OS X)
Any help appreciated.
-
rahul over 5 yearsConfirmed.. This works on Mojave 10.14. Also it doesn't require you to install XCode or XCode command line tools separately.
-
C.K. over 5 yearsThis answer solves my
pyenv install 3.6.8
problem. Thanks! -
cglacet almost 5 yearsThere is nothing there for me, the only thing in here look to be:
/Library/Developer/CommandLineTools/usr/share/man/whatis
. -
cglacet almost 5 yearsOn the other hand the cflag workaround in the link worked, ie.
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.6.8
-
Qasim over 4 yearsThese headers aren't available in Catalina, best as I can tell...