}

MacOS: Package 'libffi', required by 'gobject-2.0', not found

Created:

Error

When you try to install Pygobject using pip, you get the following error:

Package 'libffi', required by 'gobject-2.0', not found if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-tutorials_technology-medrectangle-3-0')}; Solution ========

First check that you have installed libffi using brew:

brew search libffi

If you have installed libffi, you will get the following output:

libffi ✔ brew search libffi 4.29s user 1.43s system 68% cpu 8.358 total

You will need to set some environment variables to make it available for compilers or pkg-config :

For compilers to find libffi you may need to set:

if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-tutorials_technology-medrectangle-4-0')};if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-tutorials_technology-medrectangle-4-0_1')}; .medrectangle-4-multi-137{border:none !important;display:block !important;float:none;line-height:0px;margin-bottom:2px !important;margin-left:0px !important;margin-right:0px !important;margin-top:2px !important;min-height:250px;min-width:250px;text-align:center !important;} export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"