M2 mac rbenv

投稿者:

これがあるとまずいっぽい
% brew uninstall binutils
% rbenv install 3.0.3

Thank you for reading this post, don't forget to subscribe!

ダメな時は
% arch -arm64 rbenv install 3.0.3

2.7 系はそのままでOK
% rbenv install 2.7.0

2.6 系はオプションが必要
% RUBY_CFLAGS=”-w” rbenv install 2.6.0

.zprofile


eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

.zshrc


export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"

# 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"

コンパイルが失敗する場合は

checking build system type… arm-apple-darwin22.1.0
checking host system type… arm-apple-darwin22.1.0
checking target system type… arm-apple-darwin22.1.0
checking whether the C compiler works… no

コンパイラの場所を指定してインストール実行

% CC=/usr/bin/gcc rbenv install 2.5.1