brew update failed with "Error: Git must be installed and in your PATH!"

Created on 11 Dec 2017  Â·  31Comments  Â·  Source: Linuxbrew/brew

Please fill out the issue checklist below, and provide all of the requested information.

Please always follow these steps:

  • [x] Confirmed this is a problem with running a brew command and not brew installing or the post-install behaviour of one or more formulae? If it's a formulae-specific problem please file this issue at the relevant tap e.g. for Linuxbrew/homebrew-core https://github.com/Linuxbrew/homebrew-core/issues/new
  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed all issues and retried your prior step?
  • [x] Ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:
brew update gives:

Warning: git 2.15.1 is already installed
Error: Git must be installed and in your PATH!

I tried remove git by brew uninstall --force git and reinstall using brew install git and it ended up the same.
Note that I have to install linuxbrew in /scratch/.linuxbrew and symlink that directory to /home/linuxbrew/.linuxbrew but other than that there's nothing special in my linuxbrew setup. Also, I noticed there was a homebrew issue: https://github.com/Homebrew/homebrew-core/issues/3029 and I'm not sure if it's related because linuxbrew has been working fine until a recently.
Here's the output from brew config:

HOMEBREW_VERSION: >1.2.0 (shallow or no git repository)
ORIGIN: (none)
HEAD: (none)
Last commit: never
Core tap ORIGIN: (none)
Core tap HEAD: (none)
Core tap last commit: never
HOMEBREW_PREFIX: /scratch/.linuxbrew
HOMEBREW_REPOSITORY: /scratch/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /scratch/.linuxbrew/Cellar
HOMEBREW_CACHE: /scratch/.cache
HOMEBREW_CELLAR: /scratch/.linuxbrew/Cellar
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENV_FILTERING: 1
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_GIT_CONFIG_DEVELOPERMODE: true
HOMEBREW_LOGS: /scratch/.cache
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
HOMEBREW_PREFIX: /scratch/.linuxbrew
HOMEBREW_REPOSITORY: /scratch/.linuxbrew/Homebrew
HOMEBREW_TEMP: /scratch/tmp
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /scratch/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 5.0 build 
Git: N/A
Curl: 7.57.0 => /scratch/.linuxbrew/opt/curl/bin/curl
Perl: /home/linuxbrew/.linuxbrew/bin/perl => /scratch/.linuxbrew/Cellar/perl/5.26.1/bin/perl
Python: /scratch/.linuxbrew/opt/python/libexec/bin/python => /scratch/.linuxbrew/Cellar/python/2.7.14/bin/python2.7
Ruby: /home/linuxbrew/.linuxbrew/bin/ruby => /scratch/.linuxbrew/Cellar/ruby/2.4.2/bin/ruby
Java: openjdk version "1.8.0_144"
Kernel: Linux 2.6.32-696.13.2.el6.x86_64 x86_64 GNU/Linux
OS: CentOS release 6.9 (Final) (Final)
Host glibc: 2.12
/usr/bin/gcc: 4.4.7
glibc: 2.23
gcc: 5.4.0
xorg: 20170115

Here's the output of brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  /home/linuxbrew/.linuxbrew/bin/icu-config
  /home/linuxbrew/.linuxbrew/bin/xslt-config
  /home/linuxbrew/.linuxbrew/bin/python3.6m-config
  /home/linuxbrew/.linuxbrew/bin/python2.7-config
  /home/linuxbrew/.linuxbrew/bin/Magick++-config
  /home/linuxbrew/.linuxbrew/bin/nspr-config
  /home/linuxbrew/.linuxbrew/bin/sdl2-config
  /home/linuxbrew/.linuxbrew/bin/freetype-config
  /home/linuxbrew/.linuxbrew/bin/MagickCore-config
  /home/linuxbrew/.linuxbrew/bin/libgcrypt-config
  /home/linuxbrew/.linuxbrew/bin/croco-0.6-config
  /home/linuxbrew/.linuxbrew/bin/gpg-error-config
  /home/linuxbrew/.linuxbrew/bin/gdlib-config
  /home/linuxbrew/.linuxbrew/bin/xml2-config
  /home/linuxbrew/.linuxbrew/bin/ncurses6-config
  /home/linuxbrew/.linuxbrew/bin/pkg-config
  /home/linuxbrew/.linuxbrew/bin/llvm-config
  /home/linuxbrew/.linuxbrew/bin/gsl-config
  /home/linuxbrew/.linuxbrew/bin/ncursesw6-config
  /home/linuxbrew/.linuxbrew/bin/libwmf-config
  /home/linuxbrew/.linuxbrew/bin/pcre-config
  /home/linuxbrew/.linuxbrew/bin/python3-config
  /home/linuxbrew/.linuxbrew/bin/jemalloc-config
  /home/linuxbrew/.linuxbrew/bin/caca-config
  /home/linuxbrew/.linuxbrew/bin/guile-config
  /home/linuxbrew/.linuxbrew/bin/MagickWand-config
  /home/linuxbrew/.linuxbrew/bin/python2-config
  /home/linuxbrew/.linuxbrew/bin/libpng-config
  /home/linuxbrew/.linuxbrew/bin/libpng16-config
  /home/linuxbrew/.linuxbrew/bin/wx-config
  /home/linuxbrew/.linuxbrew/bin/curl-config
  /home/linuxbrew/.linuxbrew/bin/cups-config
  /home/linuxbrew/.linuxbrew/bin/orbit2-config
  /home/linuxbrew/.linuxbrew/bin/krb5-config
  /home/linuxbrew/.linuxbrew/bin/autoopts-config
  /home/linuxbrew/.linuxbrew/bin/python3.6-config

Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
  brew install git
Warning: Use tcl-tk instead of deprecated homebrew/dupes/tcl-tk
Warning: Use tcl-tk instead of deprecated homebrew/dupes/tcl-tk
  • Step-by-step reproduction instructions (by running brew commands)
    just run brew update
bug

Most helpful comment

Possibly related: I reproduced the same on High Sierra, and after performing the HOMEBREW_NO_ENV_FILTERING=1 hack, I managed to make some progress; then I noticed the following message:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

...and so I am wondering if — because I need to update Xcode — the env-filtering code is perhaps aborting part-way-through, and somehow corrupting the PATH which Brew uses, and then failing to find Git?

UPDATE: it appears to have been fixed, after doing:

  • export HOMEBREW_NO_ENV_FILTERING=1
  • xcode-select --install
  • brew update
  • brew upgrade

...and then starting a new Terminal shell to try a fresh environment

All 31 comments

Warning: git 2.15.1 is already installed
Error: Git must be installed and in your PATH!

Well that certainly seems contradictory.

Git: N/A

That's not good.

Please report…

which -a git
git --version
$(brew --repo)/Library/Homebrew/shims/scm/git --homebrew=print-path
$(brew --repo)/Library/Homebrew/shims/scm/git --version
$(brew --prefix)/opt/git/bin/git --version
brew irb <<<'Utils.git_available?'
HOMEBREW_GIT=$(brew --prefix)/opt/git/bin/git brew irb <<<'Utils.git_available?'
HOMEBREW_GIT=$(brew --prefix)/opt/git/bin/git brew config
HOMEBREW_GIT=$(brew --prefix)/opt/git/bin/git brew update
+ which -a git
/home/linuxbrew/.linuxbrew/bin/git
/scratch/.linuxbrew/bin/git
/home/linuxbrew/.linuxbrew/bin/git
/scratch/.linuxbrew/bin/git
+ git --version
git version 2.15.1
++ brew --repo
+ /scratch/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git --homebrew=print-path
/home/linuxbrew/.linuxbrew/bin/git
++ brew --repo
+ /scratch/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git --version
git version 2.15.1
++ brew --prefix
+ /scratch/.linuxbrew/opt/git/bin/git --version
git version 2.15.1
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
Utils.git_available?
false

++ brew --prefix
+ HOMEBREW_GIT=/scratch/.linuxbrew/opt/git/bin/git
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
Utils.git_available?
true

++ brew --prefix
+ HOMEBREW_GIT=/scratch/.linuxbrew/opt/git/bin/git
+ brew config
HOMEBREW_VERSION: >1.2.0 (shallow or no git repository)
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: e16e32f0fdff0fb236074cef195140d34de85f5f
Last commit: 32 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 1a9aaedf2267909ca757a5273e6b5916411ef6d5
Core tap last commit: 5 hours ago
HOMEBREW_PREFIX: /scratch/.linuxbrew
HOMEBREW_REPOSITORY: /scratch/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /scratch/.linuxbrew/Cellar
HOMEBREW_CACHE: /scratch/.cache
HOMEBREW_CELLAR: /scratch/.linuxbrew/Cellar
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENV_FILTERING: 1
HOMEBREW_GIT: /scratch/.linuxbrew/opt/git/bin/git
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_GIT_CONFIG_DEVELOPERMODE: true
HOMEBREW_LOGS: /scratch/.cache
HOMEBREW_PREFIX: /scratch/.linuxbrew
HOMEBREW_REPOSITORY: /scratch/.linuxbrew/Homebrew
HOMEBREW_TEMP: /scratch/tmp
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /scratch/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 5.0 build 
Git: 2.15.1 => /scratch/.linuxbrew/opt/git/bin/git
Curl: 7.57.0 => /scratch/.linuxbrew/opt/curl/bin/curl
Perl: /home/linuxbrew/.linuxbrew/bin/perl => /scratch/.linuxbrew/Cellar/perl/5.26.1/bin/perl
Python: /scratch/.linuxbrew/opt/python/libexec/bin/python => /scratch/.linuxbrew/Cellar/python/2.7.14/bin/python2.7
Ruby: /home/linuxbrew/.linuxbrew/bin/ruby => /scratch/.linuxbrew/Cellar/ruby/2.4.2/bin/ruby
Java: openjdk version "1.8.0_144"
Kernel: Linux 2.6.32-696.13.2.el6.x86_64 x86_64 GNU/Linux
OS: CentOS release 6.9 (Final) (Final)
Host glibc: 2.12
/usr/bin/gcc: 4.4.7
glibc: 2.23
gcc: 5.4.0
xorg: 20170115
++ brew --prefix
+ HOMEBREW_GIT=/scratch/.linuxbrew/opt/git/bin/git
+ brew update
Already up-to-date.

That's a weird one. I tried to reproduce it myself by removing the system-installed /usr/bin/git and installing the brewed git. brew happily found git at $HOMEBREW_PREFIX/opt/git/bin/git, so I'm not sure why yours doesn't. Here's the code for Utils.git_available?
https://github.com/Linuxbrew/brew/blob/master/Library/Homebrew/utils/git.rb#L30

    @git ||= quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version"

All it does is run $(brew --repo)/Library/Homebrew/shims/scm/git --version, and from your output above, that returns…

git version 2.15.1

My best guess is that PATH is set differently inside brew. Any chance that you have the environment variable HOMEBREW_DEVELOPER set?
Please report…

brew irb <<<'[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]'
HOMEBREW_NO_ENV_FILTERING=1 brew irb <<<'[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]'
HOMEBREW_GIT=$(brew --prefix)/opt/git/bin/git brew irb <<<'[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]'

No, I confirm that HOMEBREW_DEVELOPER is never set. Here are the outputs:

+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]
SyntaxError: (irb):1: syntax error, unexpected ';', expecting ']'
[which("git"); Utils.git_available?, Utils....
              ^
(irb):1: syntax error, unexpected ',', expecting end-of-input
...h("git"); Utils.git_available?, Utils.git_path, Utils.git_ve...
...                               ^
    from /scratch/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

+ HOMEBREW_NO_ENV_FILTERING=1
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]
SyntaxError: (irb):1: syntax error, unexpected ';', expecting ']'
[which("git"); Utils.git_available?, Utils....
              ^
(irb):1: syntax error, unexpected ',', expecting end-of-input
...h("git"); Utils.git_available?, Utils.git_path, Utils.git_ve...
...                               ^
    from /scratch/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

++ brew --prefix
+ HOMEBREW_GIT=/scratch/.linuxbrew/opt/git/bin/git
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"); Utils.git_available?, Utils.git_path, Utils.git_version]
SyntaxError: (irb):1: syntax error, unexpected ';', expecting ']'
[which("git"); Utils.git_available?, Utils....
              ^
(irb):1: syntax error, unexpected ',', expecting end-of-input
...h("git"); Utils.git_available?, Utils.git_path, Utils.git_ve...
...                               ^
    from /scratch/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

Sorry, typo. Semicolon should be a comma.

brew irb <<<'[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]'
HOMEBREW_NO_ENV_FILTERING=1 brew irb <<<'[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]'
HOMEBREW_GIT=$(brew --prefix)/opt/git/bin/git brew irb <<<'[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]'
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/scratch/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git>, false, nil, nil]

+ HOMEBREW_NO_ENV_FILTERING=1
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/home/linuxbrew/.linuxbrew/bin/git>, true, "/home/linuxbrew/.linuxbrew/bin/git", "2.15.1"]

++ brew --prefix
+ HOMEBREW_GIT=/scratch/.linuxbrew/opt/git/bin/git
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/scratch/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git>, true, "/scratch/.linuxbrew/opt/git/bin/git", "2.15.1"]

Same issue on Ubuntu 16.04

+ which -a git
/home/linuxbrew/.linuxbrew/bin/git
+ git --version
git version 2.15.1
++ brew --repo
+ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git --homebrew=print-path
/home/linuxbrew/.linuxbrew/bin/git
++ brew --repo
+ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git --version
git version 2.15.1
++ brew --prefix
+ /home/linuxbrew/.linuxbrew/opt/git/bin/git --version
git version 2.15.1
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
Utils.git_available?
false

++ brew --prefix
+ HOMEBREW_GIT=/home/linuxbrew/.linuxbrew/opt/git/bin/git
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
Utils.git_available?
true

++ brew --prefix
+ HOMEBREW_GIT=/home/linuxbrew/.linuxbrew/opt/git/bin/git
+ brew config
HOMEBREW_VERSION: >1.2.0 (shallow or no git repository)
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 159c1f3c3ce579b37bfa503b93ab4f46eee42f1c
Last commit: 16 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: fb5208b94ad113701eb0d4d8461398ab26b280fa
Core tap last commit: 18 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/avetisk/.cache/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENV_FILTERING: 1
HOMEBREW_GIT: /home/linuxbrew/.linuxbrew/opt/git/bin/git
HOMEBREW_GIT_CONFIG_DEVELOPERMODE: true
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
CPU: octa-core 64-bit 0x64d
Homebrew Ruby: 2.3.3 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: N/A
Git: 2.15.1 => /home/linuxbrew/.linuxbrew/opt/git/bin/git
Curl: 7.57.0 => /home/linuxbrew/.linuxbrew/opt/curl/bin/curl
Perl: /home/linuxbrew/.linuxbrew/bin/perl => /home/linuxbrew/.linuxbrew/Cellar/perl/5.26.1/bin/perl
Python: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python => /home/linuxbrew/.linuxbrew/Cellar/python/2.7.14/bin/python2.7
Ruby: N/A
Java: N/A
Kernel: Linux 4.4.103-mainline-rev1 x86_64 GNU/Linux
OS: Ubuntu 16.04.3 LTS (xenial)
Host glibc: 2.23
/usr/bin/gcc: 5.4.0
glibc: N/A
gcc: 5.4.0
xorg: N/A
++ brew --prefix
+ HOMEBREW_GIT=/home/linuxbrew/.linuxbrew/opt/git/bin/git
+ brew update
Already up-to-date.
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git>, false, nil, nil]

+ HOMEBREW_NO_ENV_FILTERING=1
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/home/linuxbrew/.linuxbrew/bin/git>, true, "/home/linuxbrew/.linuxbrew/bin/git", "2.15.1"]

++ brew --prefix
+ HOMEBREW_GIT=/home/linuxbrew/.linuxbrew/opt/git/bin/git
+ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
Switch to inspect mode.
[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]
[#<Pathname:/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/scm/git>, true, "/home/linuxbrew/.linuxbrew/opt/git/bin/git", "2.15.1"]

As a work around for now, set…

export HOMEBREW_NO_ENV_FILTERING=1

Thanks! It works!

I hope you will find the real problem being this, though.

Can you test whether PR https://github.com/Linuxbrew/brew/pull/537 resolves your issue without setting HOMEBREW_NO_ENV_FILTERING?

cd $(brew --repo)
git fetch origin pull/537/head:pr537
git checkout pr537
unset HOMEBREW_NO_ENV_FILTERING
brew irb <<<'[which("git"), Utils.git_available?, Utils.git_path, Utils.git_version]'
git checkout master

@sjackman: it works :)

Output from the brew irb:

[#<Pathname:/home/linuxbrew/.linuxbrew/bin/git>, true, "/home/linuxbrew/.linuxbrew/bin/git", "2.15.1"]

BTW, I think there's a typo in your snippet (s/534/537/g).

I'm experiencing the same issue. I had to use, as suggested, HOMEBREW_NO_ENV_FILTERING=1.

BTW, I think there's a typo in your snippet (s/534/537/g).

Woops, yep. I've corrected it above for others.

I have the same issue. The solution in PR #537 does not work for me. The workaround HOMEBREW_NO_ENV_FILTERING=1 does work.

Same issue on Elementary OS, and works fine on Antergos.

What is the best way to update brew to get these new fixes? Do I need to uninstall brew and reinstall? "brew update" doesn't do anything it seems.

(well, I put the export work around above, and did brew update, and that worked...)

Possibly related: I reproduced the same on High Sierra, and after performing the HOMEBREW_NO_ENV_FILTERING=1 hack, I managed to make some progress; then I noticed the following message:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

...and so I am wondering if — because I need to update Xcode — the env-filtering code is perhaps aborting part-way-through, and somehow corrupting the PATH which Brew uses, and then failing to find Git?

UPDATE: it appears to have been fixed, after doing:

  • export HOMEBREW_NO_ENV_FILTERING=1
  • xcode-select --install
  • brew update
  • brew upgrade

...and then starting a new Terminal shell to try a fresh environment

@alecmroo Is there a particular reason that you're using Linuxbrew/brew on macOS? Although it's officially supported, most macOS users would use Homebrew/brew instead. Linuxbrew is a fork of Homebrew that adds support for Linux.

@alecmroo

THX your 4 Step's fixed it for me too...

I just got bit w/ this bug myself.

537 doesn't work

544 appears to work

545 appears to work

HOMEBREW_NO_ENV_FILTERING=1 appears to be the only solution that works on master

@nega0 Please report the output of…

brew config
which -a git
git --version
/usr/bin/git --version
env -u HOMEBREW_NO_ENV_FILTERING brew update
HOMEBREW_NO_ENV_FILTERING=1 brew update

@sjackman I will, but unfortunately it will have to wait as linuxbrew is not currently in the same state. In the meantime #565 may have some info. (Again, not exactly the same state.)

as requested...

[nega@zinc ~]$ brew config
HOMEBREW_VERSION: 1.5.0-25-g34aa15b
ORIGIN: https://github.com/Linuxbrew/brew.git
HEAD: 34aa15b69f49b17862c7d0ea6c22692672cfc607
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: c0108276ea37dadc512dc75c4825c59764777d57
Core tap last commit: 21 hours ago
HOMEBREW_PREFIX: /build/linuxbrew
HOMEBREW_REPOSITORY: /build/linuxbrew
HOMEBREW_CELLAR: /build/linuxbrew/Cellar
HOMEBREW_BUILD_FROM_SOURCE: 1
HOMEBREW_CACHE: /home/nega/.cache/Homebrew
HOMEBREW_CELLAR: /build/linuxbrew/Cellar
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_ENV_FILTERING: 1
HOMEBREW_PREFIX: /build/linuxbrew
HOMEBREW_REPOSITORY: /build/linuxbrew
CPU: octa-core 64-bit penryn
Homebrew Ruby: 2.4.0 => /opt/rh/rh-ruby24/root/usr/bin/ruby
Clang: N/A
Git: 1.9.4 => /opt/rh/git19/root/usr/bin/git
Curl: 7.19.7 => /usr/bin/curl
Perl: /usr/bin/perl
Python: /opt/rh/python27/root/usr/bin/python => /opt/rh/python27/root/usr/bin/python2.7
Ruby: /opt/rh/rh-ruby24/root/usr/bin/ruby
Java: openjdk version "1.8.0_161"
Kernel: Linux 2.6.32-696.el6.x86_64 x86_64 GNU/Linux
OS: Scientific Linux release 6.9 (Carbon) (Carbon)
Host glibc: 2.12
/usr/bin/gcc: 4.4.7
glibc: N/A
gcc: N/A
xorg: N/A
[nega@zinc ~]$ which -a git
/opt/rh/git19/root/usr/bin/git
/usr/bin/git
[nega@zinc ~]$ git --version
git version 1.9.4
[nega@zinc ~]$ /usr/bin/git --version
git version 1.7.1
[nega@zinc ~]$ env -U HOMEBREW_NO_ENV_FILTERING brew update
env: invalid option -- 'U'
Try `env --help' for more information.
[nega@zinc ~]$ env -u HOMEBREW_NO_ENV_FILTERING brew update
error: unknown option `list'
usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]
   or: git tag -d <tagname>...
   or: git tag -l [-n[<num>]] [<pattern>]
   or: git tag -v <tagname>...

    -l                    list tag names
    -n[<n>]               print <n> lines of each tag message
    -d                    delete tags
    -v                    verify tags

Tag creation options
    -a                    annotated tag, needs a message
    -m <msg>              message for the tag
    -F <FILE>             message in a file
    -s                    annotated and GPG-signed tag
    -u <key-id>           use another key to sign the tag
    -f, --force           replace the tag if exists

Tag listing options
    --contains <commit>   print only tags that contain the commit

error: unknown option `list'
usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]
   or: git tag -d <tagname>...
   or: git tag -l [-n[<num>]] [<pattern>]
   or: git tag -v <tagname>...

    -l                    list tag names
    -n[<n>]               print <n> lines of each tag message
    -d                    delete tags
    -v                    verify tags

Tag creation options
    -a                    annotated tag, needs a message
    -m <msg>              message for the tag
    -F <FILE>             message in a file
    -s                    annotated and GPG-signed tag
    -u <key-id>           use another key to sign the tag
    -f, --force           replace the tag if exists

Tag listing options
    --contains <commit>   print only tags that contain the commit

which: no ruby in (/usr/bin:/bin:/usr/sbin:/sbin)
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics.html

error: unknown option `local'
usage: git config [options]

Config file location
    --global              use global config file
    --system              use system config file
    -f, --file <FILE>     use given config file

Action
    --get                 get value: name [value-regex]
    --get-all             get all values: key [value-regex]
    --get-regexp          get values for regexp: name-regex [value-regex]
    --replace-all         replace all matching variables: name value [value_regex]
    --add                 adds a new variable: name value
    --unset               removes a variable: name [value-regex]
    --unset-all           removes all matches: name [value-regex]
    --rename-section      rename section: old-name new-name
    --remove-section      remove a section: name
    -l, --list            list all
    -e, --edit            opens an editor
    --get-color <slot>    find the color configured: [default]
    --get-colorbool <slot>
                          find the color setting: [stdout-is-tty]

Type
    --bool                value is "true" or "false"
    --int                 value is decimal number
    --bool-or-int         value is --bool or --int
    --path                value is a path (file or directory name)

Other
    -z, --null            terminate values with NUL byte

Error: Failure while executing: git config --local --replace-all homebrew.analyticsmessage true
[nega@zinc ~]$ HOMEBREW_NO_ENV_FILTERING=1 brew update
Already up-to-date.
[nega@zinc ~]$ 

There's the auto-install of portable-ruby that I didn't see in #566.

Mojave macOS has this problem. Unable to update brew.

This repository is for Linuxbrew. Please report issues with Homebrew on macOS to https://github.com/Homebrew/brew/issues

@bisherbas I had to reinstall xcode-select with xcode-select --install, but I was able to run brew update after I did.

To me, this was fixed after I xcode-select --install

@bisherbas @julienroger @niufei8888

As stated by @sjackman, this thread is relevant to Linuxbrew and not Homebrew. Xcode is Mac software not Linux software. Anything that references MacOS or xcode should be included in a respective Homebrew thread.

Cheers,
James

Same here. xcode-select --install fixed the issue. @sjackman Thanks for the reminder. Totally missed that.

Let's close this. Please report problems on mac to https://github.com/Homebrew/brew.
This repository is for Linux only. Thanks!

Was this page helpful?
0 / 5 - 0 ratings