3

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Eamonn
  • 161
  • 2
  • 7
  • This might be of some help : https://stackoverflow.com/questions/11038028/what-is-the-best-safest-way-to-reinstall-homebrew – Philippe Dec 28 '19 at 00:52
  • I can uninstall it, but the reinstallation doesn't work properly and I end up with the same error. I think it has something to do with ruby, but I need ruby to install homebrew and homebrew to install ruby or RVM. Even macports installations fail. – Eamonn Dec 28 '19 at 00:59
  • Some wild suggestions: Did you give Terminal full disk access? Did you do a gem system update? – matt Dec 28 '19 at 02:41
  • yes and yes. :( – Eamonn Dec 28 '19 at 03:15

3 Answers3

1

I just got this issue, and looking around the code I found that the issue come from the HOMEBREW_TEMP env var.

I've just created a tmp local folder in my home and ran the command like that:

HOMEBREW_TEMP=~/.tmp brew install gpg

Which workaround the issue.

ZedTuX
  • 2,859
  • 3
  • 28
  • 58
0

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

Eamonn
  • 161
  • 2
  • 7
  • You could have done `which ruby` to see if it has an executable removed? As you see, every warning has to do with a .rb script – Shahin Dec 28 '19 at 05:54
  • I did, it was saying version 2.7.0, which is what I had installed using rbenv. – Eamonn Dec 28 '19 at 22:01
0

Uninstalling and reinstalling worked for me.

From OSXDaily:

For uninstalling Homebrew in MacOS Catalina, macOS Big Sur, and MacOS Mojave:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

For uninstalling Homebrew from MacOS High Sierra, Sierra, El Capitan, and earlier:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Samir
  • 144
  • 1
  • 4
  • 12