OSX Solution: No package 'gobject-introspection-1.0' found

The error

When you execute:

$ pkg-config --print-errors --exists gobject-introspection-1.0 >= 1.46.0

You have the following error:


Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-introspection-1.0' found
Package 1.46.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `1.46.0.pc'
to the PKG_CONFIG_PATH environment variable
No package '1.46.0' found

Solution

First install glib with brew

brew install gobject-introspection

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

Error: gobject-introspection 1.62.0 is already installed
To upgrade to 1.64.0, run `brew upgrade gobject-introspection`.

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

 $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/gobject-introspection/VERSION/lib/pkgconfig