损坏的自制程序-键入“ brew”和任何内容时出现回溯错误

时间:2019-12-27 23:07:01

标签: bash terminal homebrew zsh macos-catalina

该如何解决?

我在Mac上打开终端,然后在ZSH或bash中键入:“ brew”,甚至是“ brew doctor”,并且出现以下错误:

Traceback (most recent call last):
13: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
11: from /usr/local/Homebrew/Library/Homebrew/global.rb:28: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 /usr/local/Homebrew/Library/Homebrew/config.rb:56:in `<top (required)>'
 7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:578:in `mkpath'
 6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in `mkdir_p'
 5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in `each'
 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in `block in mkdir_p'
 3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in `reverse_each'
 2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:217:in `block (2 levels) in mkdir_p'
 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in `mkdir': File exists @ dir_s_mkdir - /private/tmp (Errno::EEXIST)

我尝试过:

  • 酿酒师:也犯了同样的错误
  • 卸载自制软件并重新安装它:出现相同的错误,并显示“失败:/ usr / local / bin / brew update --force”

  • sudo-ing brew医生:给我有关授予管理员特权的错误,并拒绝继续。

  • 尝试升级红宝石:

    • 已安装的RVM,
    • 称为“ rvm install ruby​​-2.7.0”
    • 连续大约5次收到相同的错误,之后它给了我:

      更新系统..... 安装所需的软件包:autoconf,automake,libtool,pkg-config,coreutils,libyaml,libksba,readline,zlib,openssl @ 1.1。。存在软件包安装错误,请确保阅读日志。 | 尝试brew tap --repair并确保brew doctor看起来合理。

    检查自制软件要求https://docs.brew.sh/Installation 。 运行'requirements_osx_brew_libs_install autoconf automake libtool pkg-config coreutils libyaml libksba readline zlib openssl@1.1'时出错, 请阅读/Users/myName/.rvm/log/1577488510_ruby-2.7.0/package_install_autoconf_automake_libmake_libtool_pkg-config_coreutils_libyaml_libksba_readline_zlib_openssl@1.1.log 需求安装失败,状态为:1。

    • 尝试“ brew tap –repair”:出现相同的错误。

运行MacOS Catalina 10.15.2

更新1: 设法使用rbenv安装ruby 2.7.0,尝试重新安装homebrew。同样的问题。

更新2: 这台Mac是从Time Machine备份构建的,我猜这引起了所有麻烦。将拯救妇女和儿童,擦拭驱动器并进行清洁安装。

2 个答案:

答案 0 :(得分:1)

我刚遇到这个问题,然后环顾代码,发现问题来自HOMEBREW_TEMP环境变量。

我刚刚在自己的家中创建了一个tmp本地文件夹,并运行了这样的命令:

HOMEBREW_TEMP=~/.tmp brew install gpg

解决该问题的方法。

答案 1 :(得分:0)

全新安装的MacOS,无需从Time Machine进行迁移即可对其进行修复。是吗?