this is caused by the environment flags not being set in your shell.
you need to run brew install libffi
, but to do that, the env vars must be set in your shell
brew info libffi
will tell you the variables you need:
For compilers to find libffi you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
for ZSH, edit ~/.zshenv
and add:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
Close & reopen your terminal window or source ~/.zshrc
to load your changes
Check your work with
% echo $LDFLAGS
-L/opt/homebrew/opt/libffi/lib
% echo $CPPFLAGS
-I/opt/homebrew/opt/libffi/include
% echo $PKG_CONFIG_PATH
/opt/homebrew/opt/libffi/lib/pkgconfig
(confirm that the environment variables are correct)
re-try to install the rvm version you want to install.