1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【解決】M1 MacでRubyがインストールできない"BUILD FAILED (macOS 26.1 on x86_64 using ruby-build 20251117)" 時の対処法

Posted at

問題

M1 Mac(Apple Silicon)でrbenvを使ってRubyをインストールしようとしたところ、以下のようなエラーが発生し、インストールできませんでした。(実行時期:2025/11)

// 全部エラーになる
% rbenv install 3.0.3

% rbenv install 3.1.4

% rbenv install 3.3.10
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.3.10.tar.gz...
-> curl -q -fL -o ruby-3.3.10.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.10.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.2M  100 21.2M    0     0  21.5M      0 --:--:-- --:--:-- --:--:-- 21.5M
==> Installing ruby-3.3.10...
ruby-build: using libyaml from homebrew
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.10" --with-openssl-dir=/opt/homebrew/opt/openssl@3 --enable-shared --with-libyaml-dir=/opt/homebrew/opt/libyaml --with-ext=openssl,psych,+
-> make -j 8
*** Following extensions are not compiled:
openssl:
	Could not be configured. It will not be installed.
	/private/var/folders/sz/43b19mk52jg2nqsqhpcj4xjm0000gn/T/ruby-build.20251126223955.52053.Q2nHAE/ruby-3.3.10/ext/openssl/extconf.rb:122: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
	Check /var/folders/sz/43b19mk52jg2nqsqhpcj4xjm0000gn/T/ruby-build.20251126223955.52053.Q2nHAE/ruby-3.3.10/ext/openssl/mkmf.log for more details.
psych:
	Could not be configured. It will not be installed.
	Check /var/folders/sz/43b19mk52jg2nqsqhpcj4xjm0000gn/T/ruby-build.20251126223955.52053.Q2nHAE/ruby-3.3.10/ext/psych/mkmf.log for more details.

BUILD FAILED (macOS 26.1 on x86_64 using ruby-build 20251117)

You can inspect the build directory at /var/folders/sz/43b19mk52jg2nqsqhpcj4xjm0000gn/T/ruby-build.20251126223955.52053.Q2nHAE
See the full build log at /var/folders/sz/43b19mk52jg2nqsqhpcj4xjm0000gn/T/ruby-build.20251126223955.52053.log

解決方法

(1) インストール可能なRubyのバージョンを確認

% rbenv install -l
3.2.9
3.3.10
3.4.7
jruby-10.0.2.0
mruby-3.4.0
picoruby-3.0.0
truffleruby-25.0.0
truffleruby+graalvm-25.0.0

Only latest stable releases for each Ruby implementation are shown.
Use `rbenv install --list-all' to show all local versions.

(2) 最新の安定版(例:3.3.10)をインストール

3.3.10は、インストールできました。

% rbenv install 3.3.10
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.3.10.tar.gz...
-> curl -q -fL -o ruby-3.3.10.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.10.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.2M  100 21.2M    0     0  23.5M      0 --:--:-- --:--:-- --:--:-- 23.5M
==> Installing ruby-3.3.10...
ruby-build: using libyaml from homebrew
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.10" --with-openssl-dir=/opt/homebrew/opt/openssl@3 --enable-shared --with-libyaml-dir=/opt/homebrew/opt/libyaml --with-ext=openssl,psych,+
-> make -j 8
-> make install
==> Installed ruby-3.3.10 to /Users/xxx/.rbenv/versions/3.3.10

終わりに

Apple SiliconやHomebrew環境では、Rubyのバージョンや依存ライブラリの関係でインストールにハマることがあります。
困ったときは、まずは最新の安定版Rubyで試してみるのがおすすめです。

ご参考になれば幸いです!

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?