Search code examples
bashterminalhomebrewzshmacos-catalina

Broken Homebrew - getting traceback error when typing "brew" + anything


How do I fix this?

I open terminal on my Mac, and in either ZSH or bash, type: "brew", or even "brew doctor", and I get the following error:

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)

I tried:

  • Brew doctor: gave the same error
  • Uninstalling homebrew and reinstalling it: ends with the same error and "Failed during: /usr/local/bin/brew update --force"

  • sudo-ing brew doctor: gave me an error about granting admin privileges and refused to continue.

  • tried upgrading ruby:

    • installed RVM,
    • called "rvm install ruby-2.7.0"
    • got the same error about 5 times in a row, after which it gave me:

      Updating system.......... Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libyaml, libksba, readline, zlib, openssl@1.1..There were package installation errors, make sure to read the log. | .Try brew tap --repair and make sure brew doctor looks reasonable.

    Check Homebrew requirements https://docs.brew.sh/Installation . Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config coreutils libyaml libksba readline zlib openssl@1.1', please read /Users/myName/.rvm/log/1577488510_ruby-2.7.0/package_install_autoconf_automake_libtool_pkg-config_coreutils_libyaml_libksba_readline_zlib_openssl@1.1.log Requirements installation failed with status: 1.

    • tried "brew tap --repair": got the same error.

Running MacOS Catalina 10.15.2

Update 1: Managed to install ruby 2.7.0 using rbenv, tried reinstalling homebrew. Same issue.

Update 2: This mac was built from a Time machine backup, which I'm guessing caused all the trouble. Gonna save the women and children, wipe the drive and clean install.


Solution

  • A clean install of MacOS, without migrating from Time Machine fixed it. yay?