DEV Community

loading...

Fix Homebrew (Brew) on macOS 11 Big Sur

saschaeggi profile image Sascha Eggenberger Originally published at saschaeggi.Medium ・2 min read

If you encounter issues with brew on macOS 11 Big Sur, than it has a high chance of being a similar issue that I ran into.

One of the many error messages regarding brew on macOS 11:

Traceback (most recent call last):
 11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
 10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
  9: from /usr/local/Homebrew/Library/Homebrew/global.rb:37:in `<top (required)>'
  8: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  7: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
  5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
  4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
  3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
  2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
  1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)
Enter fullscreen mode Exit fullscreen mode

How to fix this?

Remove old xcode command line tools

sudo rm -rf /Library/Developer/CommandLineTools

Install new xcode command line tools

sudo xcode-select --install

Update brew

brew upgrade

Note: I had to run it twice

If you still get an error message try to reinstall brew via:

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

Test if brew works

brew doctor

Now brew should work just fine under macOS Big Sur!

Discussion (0)

pic
Editor guide