Edited at

ffi-1.11.1がMac OSX High Sierraでのインストールでコケる件



$ brew install libffi

linkを試みるとこんなメッセージがでてくるので PKG_CONFIG_PATH のほうをコピっておく

$ brew link --force libffi

Warning: Refusing to link macOS-provided software: libffi
For compilers to find libffi you may need to set:
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"

ffiのgemをインストールする際に PKG_CONFIG_PATH を指定

$ PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi

Building native extensions. This could take a while...
Successfully installed ffi-1.11.1
Parsing documentation for ffi-1.11.1


参考: https://hawksnowlog.blogspot.com/2019/05/homebrew-ruby-ffi-pkgconfig.html