I want to upgrade glib to 2.82.5 through homebrew on mac running sequoia, but it failed with this python dependency not found error
==> Upgrading glib
2.82.4 -> 2.82.5
==> Patching
==> Applying 160e55575e2183464dbf5aa733d6c2df3c674c4c.diff
==> Applying hardcoded-paths.diff
==> meson setup build_staging -Dintrospection=disabled --localstatedir=/Applications/homebrew/var -Dgio_module_dir=/Appl
==> meson compile -C build_staging --verbose
==> meson install -C build_staging
==> meson setup build -Dcairo=disabled -Ddoctool=disabled --prefix=/private/tmp/glib-20250305-19490-3vm81q/glib-2.82.5/s
Last 15 lines from /Users/papika/Library/Logs/Homebrew/glib/04.meson:
Checking for size of "long" : 8
Found pkg-config: YES (/Applications/homebrew/Library/Homebrew/shims/mac/super/pkg-config) 2.3.0
Run-time dependency glib-2.0 found: YES 2.82.5
Run-time dependency gobject-2.0 found: YES 2.82.5
Run-time dependency gio-2.0 found: YES 2.82.5
Run-time dependency gmodule-2.0 found: YES 2.82.5
Run-time dependency gio-unix-2.0 found: YES 2.82.5
Run-time dependency libffi found: YES 3.4-rc1
Program pkg-config found: YES (/Applications/homebrew/Library/Homebrew/shims/mac/super/pkg-config)
Configuring config.h using configuration
Run-time dependency python found: NO (tried pkgconfig, pkgconfig and sysconfig)
meson.build:184:50: ERROR: Python dependency not found
A full log can be found at /private/tmp/glib--gobject-introspection-20250305-19490-y22fvf/gobject-introspection-1.82.0/build/meson-logs/meson-log.txt
Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!
I checked the python files in $(brew --prefix)/lib/pkgconfig
, they are correctly present
lrwxr-xr-x@ 1 ppc admin 66B Feb 7 19:41 python-3.13-embed.pc -> ../../Cellar/python@3.13/3.13.2/lib/pkgconfig/python-3.13-embed.pc
lrwxr-xr-x@ 1 ppc admin 60B Feb 7 19:41 python-3.13.pc -> ../../Cellar/python@3.13/3.13.2/lib/pkgconfig/python-3.13.pc
lrwxr-xr-x@ 1 ppc admin 62B Feb 7 19:41 python3-embed.pc -> ../../Cellar/python@3.13/3.13.2/lib/pkgconfig/python3-embed.pc
lrwxr-xr-x@ 1 ppc admin 56B Feb 7 19:41 python3.pc -> ../../Cellar/python@3.13/3.13.2/lib/pkgconfig/python3.pc
How to fix this problem? My python environment is managed by conda, with $PYTHONPATH
pointing to $HOME/.conda/envs/myenv/bin
. I tried setting $PYTHONPATH
to empty or to base environment of conda, but none works.
The answer by @hwinston gives a workaround and it works. I use python@3.13 so I only add
ENV.append_path "CPATH", "$HOMEBREW_PREFIX/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13/"
before resource("gobject-introspection").stage do
. Everything works just fine. You may need to use the whole path instead of $HOMEBREW_PREFIX
if your homebrew is at a customized location, e.g., /Applications/homebrew
in my case.
First step I found was to install python3.9 since meson depends on it. Then you have to modify glib.rb to add
ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_PREFIX/"lib/pkgconfig"
ENV["CPATH"] = HOMEBREW_PREFIX/"opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9"
before resource("gobject-introspection").stage do
so pkg-config can find the python3.9.
With these changes I was able to build glib 2.82.5.