0

Fairly new at Linux here and have a question about installing Homebrew. I'm using Centos7 and already updated all the required dependencies (cURL, etc.). When I run the Linux installation script from the Homebrew homepage, the process fails with the following error:

==> /usr/bin/sudo /bin/chown -R username:username /home/linuxbrew/.linuxbrew/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (7/7), done.
remote: Total 16 (delta 7), reused 7 (delta 7), pack-reused 9
Unpacking objects: 100% (16/16), 3.98 KiB | 94.00 KiB/s, done.
From https://github.com/Homebrew/brew
   560f5717a..31758eaa0  master     -> origin/master
HEAD is now at 31758eaa0 Merge pull request #14027 from MikeMcQuaid/devcontainer
/home/linuxbrew/.linuxbrew/bin/brew: line 26: !": event not found
/home/linuxbrew/.linuxbrew/bin/brew: line 24: HOMEBREW_NO_ENV_FILTERING: unbound variable
Failed during: /home/linuxbrew/.linuxbrew/bin/brew update --force --quiet
[usernamek@centos ~]$ 

Has anyone seen this before, or might be able to point me in the right direction? I couldn't find any info pertaining to this particular installation failure anywhere else the I looked during my research.

Per comment, adding lines from /home/linuxbrew/.linuxbrew/bin/brew:

#!/bin/bash    #line 1
#lines 21-28:
# Fail fast with concise message when requesting unfiltered environment.
# This is basically odisabled so can be removed at any major release afterwards
# and definitely if this is still here in 2023.
if [ -n "${HOMEBREW_NO_ENV_FILTERING}" ]
then
  echo "Error: HOMEBREW_NO_ENV_FILTERING was deprecated for over a year and has now been removed (because it breaks many things)!" >&2
  exit 1
fi

Edit: Here is the exact install command I ran, from the Homebrew homepage:

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

Thanks!

3
  • Hi and welcome to StackExchange. Can you edit the post and show us lines 1 and 24 through 26 of the /home/linuxbrew/.linuxbrew/bin/brew script?
    – brunson
    Commented Oct 27, 2022 at 21:14
  • Also please mention the exact command that you ran. It looks as if you possibly sourced the brew command?
    – Kusalananda
    Commented Oct 28, 2022 at 7:22
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Luigi T.
    Commented Nov 1, 2022 at 12:42

2 Answers 2

0

I had the similar issue with my new MacBook Air. It occurred after my installation was interrupted because of unstable internet connection. I fixed the issue by running the following code in my terminal :

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

Later, it will ask whether you want to remove Homebrew files? Type "Y" and press Enter.

After that open finder.

Go to your Disk and delete the Homebrew folder in the opt folder as mentioned in the terminal after uninstalling Homebrew. Note: opt is a hidden folder you can see it after pressing command + shift + . (dot)

After deleting Homebrew files re-install Homebrew :

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

I have this error Error: HOMEBREW_NO_ENV_FILTERING was deprecated for over a year and has now been removed (because it breaks many things)!

My solution was

Remove HOMEBREW_NO_ENV_FILTERING this export variable from shell configuration file(s) like .bash_profile, .zshrc, or .bashrc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .