解決するのがめんどくさかったのでメモしておく
brewでlibffiを予めインストール
$ 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