Install homebrew on mac m1 freeze at receiving objects - macos

I am trying to install homebrew on the M1 mac using following command line.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
However, the process always stuck at 4% of receiving object step as below:
......
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown wen.yan /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R wen.yan:admin /opt/homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 220323, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (47/47), done.
Receiving objects: 4% (8813/220323), 3.78 MiB | 1.79 MiB/s
I did have command line tool xcode installed and I rebooted my machine a couple of times, but no luck so far. Any ideas?

This is caused by the MacAfee installed by our IT team. Once disable it, homebrew was installed successfully.

Related

M1 Mac Problem Installing Homebrew hangs at installing XCode

I need to install homebrew to install different software packages in my computer.
However, I first tried using homebrew and got
zsh: command not found: brew
I then tried fixing this issue following different methods such as adding opt/homebrew/bin/ to the PATH, adding export PATH="$PATH:/opt/homebrew/bin/"
to my ~/.zshrc file but nothing worked. One of the methods required me to errase the folder /opt/homebrew and then install homebrew via /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" (specified in brew.sh website). This hangs during the installation. This is the output shown in my command line
~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks
==> The Xcode Command Line Tools will be installed.
Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown alchandeck /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R alchandeck:admin /opt/homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
We can see the installation hangs when trying to install XCode Command Line Tools. So, I then tried to install XCode different ways but got no luck either. Please help me figure out how to install homebrew so I can start developing in my computer! Thanks!
Blockquote
Edit:
After a while of waiting, the Xcode installation timed out (not surprised) and showed me this:
Timed out while loading data from the Apple Software Update server.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Password:
==> Installing the Command Line Tools (expect a GUI popup):
==> /usr/bin/sudo /usr/bin/xcode-select --install
xcode-select: note: install requested for command line developer tools
Press any key when the installation has completed.
I was finally able to solve it by following this post https://github.com/Homebrew/discussions/discussions/131
I basically downloaded the version of Command Line Tools that was compatible with my macOS version and then proceed as normal with my brew install command provided in brew.sh
The only caveat is that when I ran the brew install command, I was prompted with a message saying I had not agreed with the Terms and Conditions of the Command Line Tools, which was fairly easy to do any ways. After agreeing, I tried running the brew install command again and was able to install it.

Homebrew installer hangs while installing CommandLineTools on macOS Catalina

I'm trying to install Homebrew onto an Intel MacBookPro (macOS Catalina), but while running /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
in Terminal, it seems to hang while installing CommandLineTools (the specific line it hangs on is ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress).
I already have a full install of Xcode 11 on this machine (which from what I have heard installs Xcode CommandLineTools).
After navigating to /tmp, I found that it did successfully run touch and create the file described in the command it ran, but never wrote anything to it.
I waited for about an hour with no avail. Here is the log:
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their owner set to (redacted for privacy):
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their group set to admin:
/usr/local/bin
/usr/local/lib
==> The following new directories will be created:
/usr/local/etc
/usr/local/include
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/mkdir -p /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy):admin /usr/local/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy) /Users/(redacted for privacy)/Library/Caches/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
I had the same issue. I tried installing Command Line Tools(CLT) but I got the same finding software dialogue box that never progressed after a minute.
For me, it turns out that I didn't have Xcode at all and the CLT seems to be dependant on Xcode. I didn't have the Library/developer directory either.
I downloaded and installed Xcode, I still couldn't use the command line to install CLT tho, I had to download that and install manually as well.
After getting that all setup homebrew no longer tries to install CLT and is able to complete its install successfully.
I'm new to Mac and have never used before. I started at a new company and they supplied it and I'm not sure if it was pre-used as it has some apps already installed. Perhaps Xcode got removed or never existed for me.
This page explains the whole process in detail for Xcode and CLT
https://www.freecodecamp.org/news/how-to-download-and-install-xcode/
I'd reinstall Xcode command line tools:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
This same happen with me. following steps help me to solve it.
Install XCode from Apple Store
Restart your macbook
Now try to install brew by command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
I had to install the command line tools from here: https://developer.apple.com/download/all/?q=Xcode since the automatically prompted download just hangs. From there you can select the corresponding CLT version to your Xcode version.
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their owner set to (redacted for privacy):
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their group set to admin:
/usr/local/bin
/usr/local/lib
==> The following new directories will be created:
/usr/local/etc
/usr/local/include
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/lib
==> /usr/bin/sudo /bin/mkdir -p /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown (redacted for privacy) /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy):admin /usr/local/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/(redacted for privacy)/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R (redacted for privacy) /Users/(redacted for privacy)/Library/Caches/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
enter code here
Same happened to me. I had to upgrade to macOS Monterey (I was on Big Sur still).

In macOS, installing Homebrew from clean install returns an error

I'm trying to install brew on my mac (intel), I'm using this command (from the homepage of Brew https://brew.sh/):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
And it returns the following error:
==> Checking for `sudo` access (which may request your password).
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /usr/sbin/chown -R User:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
error: Could not read 02f0189335907805d422c817462674081f48ab60
error: Could not read 7e455a623a3f49f63b589ea31d72c860b1d33c06
error: Could not read 02f0189335907805d422c817462674081f48ab60
error: Could not read 7e455a623a3f49f63b589ea31d72c860b1d33c06
remote: Enumerating objects: 111915, done.
remote: Counting objects: 100% (107893/107893), done.
remote: Compressing objects: 100% (25395/25395), done.
remote: Total 107053 (delta 81151), reused 104985 (delta 79221), pack-reused 0
Receiving objects: 100% (107053/107053), 28.88 MiB | 6.37 MiB/s, done.
Resolving deltas: 99% (81133/81151), completed with 618 local objects.
fatal: pack has 18 unresolved deltas
fatal: index-pack failed
Failed during: git fetch --force origin
It doesn't give me any hint of possible follow-up actions. What should I do?
Let me know if I should post any additional information.
After hours of wandering around forums and GitHub issues, and StackOverflow answers long gone forgotten, I finally made it!
I solved it by removing my /usr/local/Homebrew folder and then reinstalling homebrew from scratch with the command from their website (https://brew.sh/).
Now, I would love to give credit to whom I got this solution from, but I can't find the link among all the tabs and docs I had open. Maybe one day...

Installing brew on macOS Catalina

I've encountered a problem while installing brew on my machine. The installation is a success till it creates a Homebrew directory in ~/local.
I've executed the following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Result
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/Homebrew
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/Homebrew
mkdir: /usr/local/bin: Not a directory
Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/Homebrew
I've tried installing using superuser mode and the system does not allow to use the superuser mode to install files from internet source.
TIA

Java Homebrew installation

I am trying to install Homebrew on my Mac, for use with Java development. I have followed the instructions at: https://brew.sh, and pasted the command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" into my terminal.
When I do this, a few scripts are executed, and I get the output:
MacBook-Pro:~ me$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown me /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at ea8be17 Merge pull request #2631 from GauthamGoli/audit_homepage_rubocop
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/me/Library/Caches/Homeb
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
Error: Could not link:
/usr/local/etc/bash_completion.d/brew
Please delete these paths and run brew update.
Error: Failed to link all completions, docs and manpages:
Permission denied - (../../../Homebrew/completions/zsh/_brew_cask, /usr/local/share/zsh/site-functions/_brew_cask)
Failed during: /usr/local/bin/brew update --force
MacBook-Pro:~ me$
So the output is telling me that it's already up-to-date, presumably because I've already tried installing it once or twice?
How can I delete the paths to run brew update, like it's telling me to?
I encountered this error. The fix is to run the command sudo chown -R $USER:admin /usr/local/* as described on the Tech Stacker blog post that solves this issue.

Resources