# OSX: cmake finding older libpng library even though brew installs latest

**URL:** https://discourse.cmake.org/t/osx-cmake-finding-older-libpng-library-even-though-brew-installs-latest/2870
**Category:** Usage
**Created:** [March 2, 2021, 5:33pm UTC](https://discourse.cmake.org/t/osx-cmake-finding-older-libpng-library-even-though-brew-installs-latest/2870 "2021-03-02T17:33:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![boxerab](https://discourse.cmake.org/user_avatar/discourse.cmake.org/boxerab/32/718_2.png) [@boxerab](https://discourse.cmake.org/u/boxerab)
#### Post date: [March 2, 2021, 5:33pm UTC](https://discourse.cmake.org/t/osx-cmake-finding-older-libpng-library-even-though-brew-installs-latest/2870/1 "2021-03-02T17:33:57Z")

</div>

I have a Github workflow that requires version 1.16 of libpng. However, on osx,  
cmake Find finds an older version 1.14 of the library

```auto
Run brew install libpng 
Warning: libpng 1.6.37 is already installed and up-to-date.
To reinstall 1.6.37, run:

...

-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.4.12") 
-- The system seems to have a libpnb available, it will be used to support PNG files

```

Any ideas on how to make cmake find the brew version ?

---

<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: [March 2, 2021, 5:56pm UTC](https://discourse.cmake.org/t/osx-cmake-finding-older-libpng-library-even-though-brew-installs-latest/2870/2 "2021-03-02T17:56:08Z")

</div>

You should be able to add `/usr/local` to `CMAKE_PREFIX_PATH`. I suspect `/usr/local` is just “behind” in the search path. Alternatively, it could be finding the library from brew and the headers (where the version number is extracted from) from the SDK. I’d look at the cache variables associated with `PNG` and see that they all “agree” that they found the same installation.
