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?

rbenvでruby3.0.7を m3 pro macにインストールする方法

Last updated at Posted at 2025-08-21

結論

以下の手順でインストール可能

step1: openssl@1.1をbrewでインストール

brew install rbenv/tap/openssl@1.1

step2: パッチをダウンロードする

https://gist.github.com/nicksieger/03bf346d3a8b63c5f822993b897da418#file-ruby-3-0-x-patch からパッチファイルをダウンロードする。

zipでダウンロードした場合は、展開する。

step3: rbenv installを実行

ダウンロードしたファイル(ruby-3.0.x.patch)があるディレクトリにて以下を実行する。

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install --patch 3.0.7 < ruby-3.0.x.patch

作業ログ

とりあえず実行

シンプルに

rbenv install 3.0.7

を実行すると以下のようなエラーが出た。

compiling new.c

ld: warning: ignoring duplicate libraries: '-lruby.3.0'

Makefile:95: *** missing separator. Stop.

make[1]: *** [ext/openssl/all] Error 2

make[1]: *** Waiting for unfinished jobs....

openssl周りがエラーっぽい

opensslを適切なものにする

色々調べたところ、以下の記事に辿り着いた
https://github.com/rbenv/ruby-build/discussions/2494

どうやらopenssl@1.1 を使う必要があるっぽい。

brew install rbenv/tap/openssl@1.1
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install 3.0.7

上記を実行したところ、以下のようなエラーに変わった

compiling fstring.c
bigdecimal.c:249:5: error: 'maybe_unused' attribute cannot be applied to types
  249 |     ENTER(1);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
ld: warning: ignoring duplicate libraries: '-lruby.3.0'
../.././include/ruby/backward/2/attributes.h:168:28: note: expanded from macro 'RB_UNUSED_VAR'
  168 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
../.././include/ruby/internal/attr/maybe_unused.h:31:39: note: expanded from macro 'RBIMPL_ATTR_MAYBE_UNUSED'
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                       ^

今度は、bigdecimal.c 周りでエラーが起きているっぽい。
これについても、https://github.com/rbenv/ruby-build/discussions/2494 を参考に、patchを適用してみた。
https://gist.github.com/nicksieger/03bf346d3a8b63c5f822993b897da418#file-ruby-3-0-x-patch をダウンロードして、rbenv実行時にパッチを適用するようにした。

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install --patch 3.0.7 < ruby-3.0.x.patch

これでインストールできた。

参考

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?