OSX Solution: PKG_CONFIG_PATH environment variable No package 'glib-2.0' found

Created:

The error

When you execute:

$ pkg-config --print-errors --exists glib-2.0 >= 2.48.0

You have the following error:

Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package 2.48.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `2.48.0.pc'
to the PKG_CONFIG_PATH environment variable
No package '2.48.0' found

Solution

First install glib with brew

brew install glib

In some cases, brew could output that the glib is already installed:

Error: glib 2.64.0 is already installed
To upgrade to 2.64.1, run `brew upgrade glib`.

You will need to also setup the PKG_CONFIG_PATH to have the glib:

 $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/glib/VERSION/lib/pkgconfig