无法在 MacOS M1 上安装自制软件

Cannot install homebrew on MacOS M1

当我运行/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 它给出了列出的信息:

==> /usr/bin/sudo /usr/sbin/chown -R ron:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at 3f4bcd7eb Merge pull request #10471 from MikeMcQuaid/formula-language-java
Traceback (most recent call last):
    22: from /opt/homebrew/Library/Homebrew/brew.rb:31:in `<main>'
    21: from /opt/homebrew/Library/Homebrew/brew.rb:31:in `require_relative'
    20: from /opt/homebrew/Library/Homebrew/global.rb:23:in `<top (required)>'
    19: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    18: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    17: from /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.1/lib/active_support/core_ext/numeric/time.rb:3:in `<top (required)>'
    16: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    14: from /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.1/lib/active_support/duration.rb:3:in `<top (required)>'
    13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    11: from /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.1/lib/active_support/core_ext/array/conversions.rb:3:in `<top (required)>'
    10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     8: from /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.1/lib/active_support/xml_mini.rb:3:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/time.rb:3:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date.rb:4:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle - /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle (LoadError)
Failed during: /opt/homebrew/bin/brew update --force --quiet

试了几种方法都不管用。有谁知道如何解决这个问题?提前致谢。

  1. ruby --版本:ruby 2.6.3p62(2019-04-16 修订版 67580) [universal.arm64e-darwin20]
  2. 哪个ruby:/usr/bin/ruby
  3. rvm 当前:系统

终于解决了。使用 brew cleanup 修复 ruby.

这对我有用 - 我遇到了同样的问题。

gem uninstall date

io-console 等、zlib、bigdecimal 也一样

而且我在 psych 和 strscan 方面也遇到了问题 - 对于这个库,我首先不得不删除包:

rm /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/psych-3.3.0/psych.bundle
rm /Library/Ruby/Gems/2.6.0/gems/psych-3.3.0/lib/psych.bundle
rm /Library/Ruby/Gems/2.6.0/gems/strscan-3.0.0/lib/strscan.bundle
rm /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/strscan-3.0.0/strscan.bundle

在 gem 卸载成功之前。在这个自制软件安装后再次运行起来就像一个魅力。

gem update

我也找回来了又出问题了,保重