Intel Mac 에서 M1 Mac 으로 마이그레이션 한 후, rbenv 를 통해 설치해뒀었던 ruby 가 정상적으로 작동하지 않아서, rbenv 를 깔끔하게 지우고, asdf 를 통해 ruby 를 설치하던 중 겪었던 이슈들이 있어, 예전 버전의 루비 설치를 workaround 를 통해 설치 성공한 것에 대한 기록
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install asdf
wget https://raw.githubusercontent.com/rbenv/homebrew-tap/e472b7861b49cc082d1db0f66f265368da107589/Formula/openssl%401.0.rb
mv openssl%401.0.rb openssl@1.0.rb
brew install openssl@1.0.rb
# ~/.zshrc 수정
```
export PATH=/Users/hanbyul.lee/.asdf/shims:/opt/homebrew/bin:/opt/homebrew/opt/openssl@1.0/bin:$PATH
. /opt/homebrew/opt/asdf/libexec/asdf.sh
# For Old ruby versions
# https://medium.com/@3minus1/installing-old-ruby-versions-on-apple-m1-step-by-step-guide-501bb893c843
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.0/lib/pkgconfig"
```
RUBY_CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.0" asdf install ruby 2.3.3
참고
https://github.com/rbenv/ruby-build/issues/1691
https://medium.com/@3minus1/installing-old-ruby-versions-on-apple-m1-step-by-step-guide-501bb893c843
https://blog.dizy.dev/rails/2019/11/12/ruby-2-4-openssl-dependency.html (갓동근님 블로그)
반응형