0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Macでrbenvを利用しようと試みた所,予想外に時間を要したので備忘録として下準備の手順を残しておこうと思います.

OpenSSLのインストール

Homebrewを用いてOpenSSLの最新バージョンをインストールします.

brew update
brew install openssl

2022/7現在の最新版はOpenSSL3.0.5がインストールされます.

.bash_profileに各種環境情報を追加

.bash_profileに以下の情報を追加します.追加後,再読み込みを行います.

export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib $LDFLAGS"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include $CPPFLAGS"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig $PKG_CONFIG_PATH"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix)/opt/openssl"
source .bash_profile

この下準備を実施せずにrbenvを実行すると以下のようにエラーが発生します.

 $ rbenv install 3.1.2 
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 12.4 using ruby-build 20220426)

下準備実施後にrbenvを実行すると無事動作しました.昔はセキュリティソフトが有効だとエラー終了していましたが,現在のバージョンでは問題無く動作しました.

$ rbenv install 3.1.2 
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
ruby-build: using readline from homebrew
Installed ruby-3.1.2 to /Users/user/.rbenv/versions/3.1.2

実行後の確認作業

$ rbenv global 3.1.2
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

Reference

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?