LoginSignup
0

More than 1 year has passed since last update.

Ruby3.1.2のインストール時にNothing to be done for `_build_programs'と出てインストールできない時の対処法

Last updated at Posted at 2023-02-03

rbenvを利用してruby3.1.2のインストールを試みたところ、opensslのコンパイル関連のエラーで躓いてしまいました。
同じ問題でインストールできない方のお役に少しでも立てたらと思い、解決までのプロセスを共有します。

エラー内容

ruby3.1.2をinstallしようとしたところ下記のエラーが発生。

$ rbenv install 3.1.2
Downloading openssl-1.1.1n.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a
Installing openssl-1.1.1n...
~/.rbenv/plugins/ruby-build/bin/ruby-build: line 1127: ~/.rbenv/versions/3.1.2/openssl/ssl/cert.pem: No such file or directory

BUILD FAILED (macOS 13.1 using ruby-build 20220426-1-gc0d87ea)

Inspect or clean up the working tree at /var/folders/xc/700s01nj3cxf7z98cmnkl3lr0000gn/T/ruby-build.20230129175734.79960.3npS5Q
Results logged to /var/folders/xc/700s01nj3cxf7z98cmnkl3lr0000gn/T/ruby-build.20230129175734.79960.log

Last 10 log lines:
created directory `~/.rbenv/versions/3.1.2/openssl/lib/engines-1.1'
*** Installing engines
install engines/capi.dylib -> ~/.rbenv/versions/3.1.2/openssl/lib/engines-1.1/capi.dylib
install engines/padlock.dylib -> ~/.rbenv/versions/3.1.2/openssl/lib/engines-1.1/padlock.dylib
make depend && make _build_programs
make[1]: Nothing to be done for `_build_programs'.
created directory `~/.rbenv/versions/3.1.2/openssl/bin'
*** Installing runtime programs
install apps/openssl -> ~/.rbenv/versions/3.1.2/openssl/bin/openssl
install ./tools/c_rehash -> ~/.rbenv/versions/3.1.2/openssl/bin/c_rehash

出力されたログを確認するとNothing to be done for _build_programs.と言われている。

解決までのプロセス

同じ事例がないか関連するいくつかのキーワードでググってみると、どうやらopensslのコンパイル関連の問題で.zshrcに環境変数RUBY_CONFIGURE_OPTSを設定すると解消したというような記事がいくつか見つかりました。

そこで、ruby-buildの公式ページにて詳細を確認。

すると、wikiで以下の記述を発見。

Suggested build environment
ruby-build will try its best to download and compile the wanted Ruby version, but sometimes compilation fails because of unmet system dependencies, or compilation succeeds but the new Ruby version exhibits weird failures at runtime. The following instructions are our recommendations for a reasonable build environment.
(日本語訳)
推奨されるビルド環境
Ruby-buildは、必要なRubyのバージョンをダウンロードしてコンパイルしようと試みますが、システムの依存関係が満たされていないためにコンパイルに失敗したり、コンパイルに成功しても実行時に奇妙な不具合が生じたりすることがあります。そこで,以下の手順で,適切なビルド環境を構築することを推奨します.

wikiによると、Ruby3.1以降では、OpenSSL3.0が必要になるとのことであり、記述されているコマンドを実行。

brew install openssl@3 readline libyaml gmp

.zshrcに環境変数を設定(設定後、source ~/.zshrcをお忘れなく)。

export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)"

再度インストールを実行すると無事にインストールできました!:congratulations:

$ 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 ~/.rbenv/versions/3.1.2

実行環境

  • MacBook Pro(2019, Intel Core i9)
  • MacOS Ventura(version13.1)

参考記事

関連記事

ruby3.2.0-devのinstallでも躓いたので解決までのプロセスを共有します。

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