Sample Header Ad - 728x90

homebrew stopped working after MacOS update

1 vote
1 answer
1232 views
I updated my MacBook Pro to Monterey (version 12.6.4). Now when I enter any brew command on the command line, I get an exception: /usr/local/Homebrew/Library/Homebrew/version.rb:366:in `initialize': Version value must be a string; got a NilClass () (TypeError) from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:23:in `initialize' from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `new' from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `version' from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:52:in `prerelease?' from /usr/local/Homebrew/Library/Homebrew/os.rb:19:in `' from /usr/local/Homebrew/Library/Homebrew/os.rb:1:in `' from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/Homebrew/Library/Homebrew/global.rb:26:in `' from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative' from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `' My ruby --version says _ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin21]_ I also tried the brew command by setting a Ruby 2.4.2 in front of the PATH search order, but same effect. Digging into the code (os.rb), I found the definition of the constant ::OS_VERSION = ENV["HOMEBREW_OS_VERSION"] and I don't have defined this environment variable, neither do I have defined HOMEBREW_OSX_VERSION. I think this could explain the NilClass exception, but I am not aware that I ever had this environment variable, and brew worked fine before. Any idea of what is going on? UPDATE: I also tried the suggestion on the homebrew page , i.e. doing a git clean -f in /usr/local/Homebrew/Library/Contributions/examples, but there is no Contributions directory, and a clean in the Homebrew base directory did not help either.
Asked by user1934428 (1458 rep)
Apr 11, 2023, 03:26 PM
Last activity: Apr 14, 2023, 01:23 PM