Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install zlib on Mac OS X Mojave (10.14)?

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 with zipimport.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.

like image 631
geoidesic Avatar asked Oct 10 '18 13:10

geoidesic


3 Answers

https://github.com/pyenv/pyenv/issues/1219

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / 
like image 160
geoidesic Avatar answered Sep 21 '22 17:09

geoidesic


It helped me as well, answer is here: https://github.com/Homebrew/homebrew-core/issues/29176 More details, this works:

  1. brew update

  2. (Re)Install CLT.

    installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / 
  3. brew reinstall python@2

like image 27
Elena Zarubaeva Avatar answered Sep 21 '22 17:09

Elena Zarubaeva


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.

like image 45
WhooNo Avatar answered Sep 20 '22 17:09

WhooNo