# CMake Error, on MacOS, Could not find ZLIB (missing: ZLIB\_LIBRARY)

**URL:** https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613
**Category:** Usage
**Created:** [July 27, 2023, 12:49am UTC](https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613 "2023-07-27T00:49:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lee\_Elliott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/lee_elliott/32/3654_2.png) [@Lee\_Elliott](https://discourse.cmake.org/u/Lee_Elliott)
#### Post date: [July 27, 2023, 12:49am UTC](https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613/1 "2023-07-27T00:49:22Z")

</div>

when configuring with cmake in order to compile azerothcore, I am receiving an CMake error where ZLIB can’t be located.  
This is what I’m getting:

```auto
Lees-MBP-2:build leeelliott$ export OPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1)
Lees-MBP-2:build leeelliott$ cmake ../ \
> -DCMAKE_INSTALL_PREFIX=/leeelliott/azerothcore/server/ \
> -DTOOLS_BUILD=all \
> -DSCRIPTS=static \
> -DMYSQL_ADD_INCLUDE_PATH=/opt/homebrew/include/mysql \
> -DMYSQL_LIBRARY=/opt/homebrew/lib/libmysqlclient.dylib \
> -DREADLINE_INCLUDE_DIR=/opt/homebrew/opt/readline/include \
> -DREADLINE_LIBRARY=/opt/homebrew/opt/readline/lib/libreadline.dylib \
> -DOPENSSL_INCLUDE_DIR="$OPENSSL_ROOT_DIR/include" \
> -DOPENSSL_SSL_LIBRARIES="$OPENSSL_ROOT_DIR/lib/libssl.dylib" \
> -DOPENSSL_CRYPTO_LIBRARIES="$OPENSSL_ROOT_DIR/lib/libcrypto.dylib"
-- CMake version: 3.27.1
-- Running cmake hook: AFTER_LOAD_CONF
-- No hooks registered for AFTER_LOAD_CONF
-- Enabled С++20 standard
-- Detected 64-bit platform
-- UNIX: Using default configuration directory
-- UNIX: Using default library directory
-- UNIX: Configuring uninstall target
-- UNIX: Created uninstall target
-- UNIX: Detected compiler: /usr/bin/cc
-- Clang: Minimum version required is 10.0.0, found 14.0.0.14000029 - ok!
-- Running cmake hook: AFTER_LOAD_CMAKE_MODULES
-- No hooks registered for AFTER_LOAD_CMAKE_MODULES
-- Using mysql-config: /usr/local/bin/mysql_config
-- Found MySQL library: /opt/homebrew/lib/libmysqlclient.dylib
-- Found MySQL headers: /usr/local/include/mysql
-- Found MySQL executable: /usr/local/bin/mysql
-- Found git binary : /usr/local/bin/git

* AzerothCore revision : a5e84f610a0e 2023-07-26 11:53:12 +0000 (master branch)
* AzerothCore buildtype : RelWithDebInfo

* Install core to : /leeelliott/azerothcore/server
* Install libraries to : /leeelliott/azerothcore/server/lib
* Install configs to : /leeelliott/azerothcore/server/etc

* Build applications : Yes (all)
* Build tools : Yes (all)
* Build with scripts : Yes (static)
* Build with modules : Yes (static)
* Build unit tests : No (default)
* Build core w/PCH : Yes (default)
* Build scripts w/PCH : Yes (default)
* Show compile-warnings : No (default)
* Use coreside debug : No (default)
* Use unix gperftools : No (default)
* Use GIT revision hash : Yes (default)
* Enable vmap DisableMgr checks : Yes (default)
* Show source tree : No (For UNIX default)

-- Found OpenSSL library: /usr/local/opt/openssl@1.1/lib/libssl.dylib;/usr/local/opt/openssl@1.1/lib/libcrypto.dylib
-- Found OpenSSL headers: /usr/local/opt/openssl@1.1/include
CMake Error at /usr/local/Cellar/cmake/3.27.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
 Could NOT find ZLIB (missing: ZLIB_LIBRARY)
Call Stack (most recent call first):
 /usr/local/Cellar/cmake/3.27.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
 /usr/local/Cellar/cmake/3.27.1/share/cmake/Modules/FindZLIB.cmake:200 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
 deps/zlib/CMakeLists.txt:15 (find_package)

-- Configuring incomplete, errors occurred!

```

I have installed zlib using brew install zlib  
Zlib folder appears to be located in /usr/local/cellar/zlib/  
How do I get cmake to recognize/find zlib?

Kind Regards,  
Lee

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 27, 2023, 2:57am UTC](https://discourse.cmake.org/t/cmake-error-on-macos-could-not-find-zlib-missing-zlib-library/8613/2 "2023-07-27T02:57:32Z")

</div>

Does `--debug-find` help see where CMake is searching? You can try adding `/usr/local/cellar/zlib` to `CMAKE_PREFIX_PATH`, but I think that location is “wrong”. Do you have to “activate” it or something to make it part of the unified Homebrew prefix?
