在Mac上安装Ruby 2.6.6或2.6.7

bxjv4tth  于 2022-11-04  发布在  Ruby
关注(0)|答案(3)|浏览(277)

Recently, I've been trying to work on a Rails project on my local workspace. I just swapped laptops (Macbook pro M1), and since then, I have been unable to install Ruby 2.6.6 and/or 2.6.7. Here is the error output when I run rbenv install 2.6.6 :

Last 10 log lines:
compiling ../.././ext/psych/yaml/dumper.c
compiling ../.././ext/psych/yaml/reader.c
compiling ../.././ext/psych/yaml/emitter.c
compiling ../.././ext/psych/yaml/parser.c
linking shared-object date_core.bundle
5 warnings generated.
linking shared-object zlib.bundle
1 warning generated.
linking shared-object psych.bundle
make:***[build-ext] Error 2

I then checked rbenv install --list and it lists 2.5.9, 2.6.7, 2.7.3, and 3.0.1. So, I tried installing 2.6.7, but that did not work either. Apparently, the installation for Ruby 2.6.7 is a known bug and has no fix as of yet ( link1 , link2 ).
If anyone has had experience with this issue, please let me know of some solutions. I have been stuck on this error for the entire day and I am quite desperate :(.

jq6vz3qz

jq6vz3qz1#

Ruby 2.6.6不支持带有M1芯片的MacBook。
如果您还想安装,可以试试我已经安装的方式:


# asdf

RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC asdf install ruby 2.6.6

# rbenv

RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.6.6

如果这不起作用,GitHub issue上还有其他选项。

kg7wmglp

kg7wmglp2#

如果rbenv install --list-all缺少2.6.6,请在更新ruby-build时尝试从头重新安装。


# Add rbenv to bash so that it loads every time you open a terminal

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc

# Install Ruby

rbenv install 2.6.6
rbenv global 2.6.6
ruby -v
nbnkbykc

nbnkbykc3#

前面的答案对我不起作用。但是,这个答案起作用了
RUBY_CFLAGS="-w" rbenv install 2.6.7

相关问题