brew install zlib-devel on Mac OS X Mavericks

有些话、适合烂在心里 提交于 2019-11-30 10:30:54

问题


Attempting to install the zlib-devel on mac os x mavericks with homebrew doesn't work:

brew install zlib-devel
Error: No available formula for zlib-devel 
Searching taps...

This install

brew install zlib

works fine though.


回答1:


Just run in the command line:

xcode-select --install

In OS X 10.9+, the command line developer tools are now installed on demand. So after running this also zlib and zlib-devel should be available (no need for brew install zlib...)




回答2:


For OS X Mojave

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

The reason is because Xcode Command Line tools no longer installs needed headers in /include. You have to run a separate command to install the needed headers.

As noted here - https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes

The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. You can find this package at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg To make sure that you're using the intended version of the command line tools, run xcode-select -s or xcode select -s /Library/Developer/CommandLineTools after installing.




回答3:


xcode-select --install doesn't solve this on Mojave for some reason.

Since this is the only library blocking, go to https://www.zlib.net and download source code. Select the "US (zlib.net)" hyperlink about halfway down the page for the tar.xz version.

Then find the download on your local machine and double click on the file. This will unzip the download and create a new folder in the same directly.

Then in Terminal:

  • cd into the directory with the download
  • then tar -xvf zlib-1.2.11.tar.xz (Note that zlib-1.2.11.tar.xz may change depending on the latest version you've downloaded. Just run whatever file you're just downloaded.)
  • Change directories cd zlib-1.2.11
  • ./configure
  • make
  • make install



回答4:


After running

xcode-select --install

Make sure your export these variables for the compiler and the pkg-config to find zlib

For compilers to find zlib you may need to set:

export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"

For pkg-config to find zlib you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

This is solved my issue with zlib

zipimport.ZipImportError: can't decompress data; zlib not available



回答5:


Unfortunately none of the above methods worked for me So I did

brew reinstall python@2
pip install six

Hope it helps



来源:https://stackoverflow.com/questions/23749530/brew-install-zlib-devel-on-mac-os-x-mavericks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!