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?
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.
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 .
On a 1 Mbps Internet connection, installing Homebrew would, in theory, take about ~1 hour.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With