Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew won't brew any more

On my MacMini with El Capitan I can't run brew any more. I get the following Error:

/usr/local/Library/Homebrew/config.rb:34:in `initialize': no implicit conversion of nil into String (TypeError)     from /usr/local/Library/Homebrew/config.rb:34:in `new'     from /usr/local/Library/Homebrew/config.rb:34:in `<top (required)>'     from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'     from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'     from /usr/local/Library/Homebrew/global.rb:18:in `<top (required)>'     from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'     from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'     from /usr/local/Library/brew.rb:10:in `<main>' 

The permissions of /usr/local are correct.

The config.rb file, which I haven't changed looks like this:

def cache   if ENV["HOMEBREW_CACHE"]     Pathname.new(ENV["HOMEBREW_CACHE"]).expand_path   else     # we do this for historic reasons, however the cache *should* be the same     # directory whichever user is used and whatever instance of brew is executed     home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path     if home_cache.directory? && home_cache.writable_real?       home_cache     else       Pathname.new("/Library/Caches/Homebrew").extend Module.new {         def mkpath           unless exist?             super             chmod 0775           end         end       }     end   end end  HOMEBREW_CACHE = cache undef cache  # Where brews installed via URL are cached HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE+"Formula"  unless defined? HOMEBREW_BREW_FILE   HOMEBREW_BREW_FILE = ENV["HOMEBREW_BREW_FILE"] || which("brew").to_s end  # Where we link under HOMEBREW_PREFIX = Pathname.new(ENV["HOMEBREW_PREFIX"])  # Where .git is found HOMEBREW_REPOSITORY = Pathname.new(ENV["HOMEBREW_REPOSITORY"])  HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"]) HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions"  # Where we store built products HOMEBREW_CELLAR = Pathname.new(ENV["HOMEBREW_CELLAR"])  HOMEBREW_LOGS = Pathname.new(ENV["HOMEBREW_LOGS"] || "~/Library/Logs/Homebrew/").expand_path  HOMEBREW_TEMP = Pathname.new(ENV.fetch("HOMEBREW_TEMP", "/tmp"))  unless defined? HOMEBREW_LIBRARY_PATH   HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew") end  HOMEBREW_LOAD_PATH = HOMEBREW_LIBRARY_PATH 

The same error occurs with brew, brew doctor, brew update etc.

Any ideas, what could be wrong?

like image 525
Arwed Avatar asked Jan 20 '16 17:01

Arwed


People also ask

Why brew is not working in Mac?

As mentioned above, one of the common reasons for getting the 'command not found brew' on Mac is due to the executable brew directory not being present in the 'PATH' environment.

Does Homebrew work on M1 Mac?

Now, on your new M1 Mac, you can install Homebrew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" . After the install is complete you'll see a message similar to the one below. Remember, Homebrew is now going to install packages in /op/homebrew/bin .

How long should Homebrew take to install?

On a 1 Mbps Internet connection, installing Homebrew would, in theory, take about ~1 hour.


1 Answers

I had the same issue - seemed to be the result of a brew update that could not complete due to permissions issues.

First I reset the repo to the latest head:

cd /usr/local/bin git reset --hard HEAD 

Then I could run:

brew doctor 

Which found permissions issues. Fixing those permissions as per instructions finally allowed me to run:

brew update 
like image 145
gollyg Avatar answered Sep 18 '22 22:09

gollyg