我在尝试使用 RVM 更新 Ruby 版本时遇到困难。我已遵循建议的步骤,包括更新 RVM 本身、安装最新的稳定 Ruby 版本并将其设置为默认版本。然而,尽管做出了这些努力,我的环境中的 Ruby 版本似乎并未成功更新。当我运行 ruby --version 这样的命令时,它仍然显示旧版本。我还尝试清理 RVM、重新启动 shell 并仔细检查 PATH,但问题仍然存在。任何关于如何使用 RVM 排除故障并成功更新我的 Ruby 版本的指导或见解将不胜感激。
当我运行 rvm install 3.0.0 时,这就是我得到的
Error running '__rvm_make -j8', please read /Users/apple/.rvm/log/1703760048_ruby-3.0.0/make.log
There has been an error while running make. Halting the installation.```
当我去检查 make 日志时,我得到的是:
../.././include/ruby/ruby.h:1837:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
}
^
ancdata.c:1440:36: note: ')' token is here
ary = rb_attr_get(ctl, rb_intern("unix_rights"));
^~~~~~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1847:56: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....`your text`
linking shared-object json/ext/parser.bundle
raddrinfo.c:2687:18: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
id_timeout = rb_intern("timeout");
^~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
raddrinfo.c:2687:18: note: '{' token is here
id_timeout = rb_intern("timeout");
^~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1832:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
{ \
^
raddrinfo.c:2687:18: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
id_timeout = rb_intern("timeout");
^~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1837:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
}
^
raddrinfo.c:2687:18: note: ')' token is here
id_timeout = rb_intern("timeout");
^~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1847:56: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
18 warnings generated.
30 warnings generated.
2 warnings generated.
linking shared-object socket.bundle
12 warnings generated.
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
+__rvm_make:0> return 2
当我尝试使用 rbenv 时,我得到了这个
BUILD FAILED (macOS 13.6.1 on x86_64 using ruby-build 20231225)
我按照更新过程的建议步骤进行操作。这包括使用 rvm get stable 更新 RVM 本身、使用 rvm install ruby --latest 安装最新的稳定 Ruby 版本,以及使用 rvm use ruby --default 将新安装的版本设置为默认版本。
由于您的 makefile 有错误
make[1]: *** [ext/openssl/all] Error 2
我将对此进行尝试并说您需要链接适当的 Openssl 二进制文件。因此,在您的终端中发出命令:
which openssl
如果你得到类似的信息:
/usr/local/bin/openssl
然后你需要告诉
make
你的openssl二进制文件在哪里。使用从 which
命令返回的路径尝试以下操作:
rvm install ruby-3.0.0 --with-openssl-dir=/usr/local/bin/openssl
替换你的 openssl 路径。