Another active Homebrew process is already in progress

MacosHomebrew

Macos Problem Overview


When I try to do this:

brew install node

I get this message:

 /usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: Permission denied
-e:1:in `initialize': Bad file descriptor (Errno::EBADF)
	from -e:1:in `new'
	from -e:1:in `<main>'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
Error: Permission denied - /usr/local/var/homebrew/locks/node.brewing

Any idea on how to solve this?

Macos Solutions


Solution 1 - Macos

Try removing the Homebrew process locks with this command:

rm -rf /usr/local/var/homebrew/locks

Solution 2 - Macos

As this thread suggests at some point, my problem was to run brew command with sudo privileges for the first time. This causes brew to try to access privileged files and folders and it fails. If that's the case for you, run these commands and try installing node again.

sudo chown -R "$USER":admin /usr/local

brew cleanup

Solution 3 - Macos

just close the terminal and reopen another

Solution 4 - Macos

Simply type the following into your terminal:

brew cleanup

This should clean up any issues. Follow the command with:

brew doctor

All done.

Solution 5 - Macos

In my case on OSX, I interrupted node install and then I try to start install node again so I got the error mentioned in the question.
I tried below steps from other responses:

sudo chown -R "$USER":admin /usr/local

brew cleanup

and

rm -rf /usr/local/var/homebrew/locks

but this message appear again - so don't know if above steps helped.

Then I closed the terminal tab and in new one ran

brew install -v node

It took 11 minutes to finish successfully node installation

Solution 6 - Macos

Change file permission will avoid this error:

sudo chown <your-username>:admin /usr/local/Homebrew/Library/Homebrew/utils/lock.sh

For permission issues with homebrew install or update:

Change your homebrew permission setting

sudo chown -R <your-username>:admin /usr/local/Homebrew

sudo chown -R <your-username>:admin /usr/local/var/homebrew

Then run homebrew install or update

Solution 7 - Macos

To unlock with any homebrew install location:

rm -rf $(brew --prefix)/var/homebrew/locks/*.lock

Solution 8 - Macos

I don't know what was going on. My only active terminal was waiting for input, no jobs running in the background. I had just tried to run an RVM install that failed and asked me to update Homebrew but that was supposed to be finished since the terminal was waiting for input. After several repeat command invocations and a couple of minutes later I stopped receiving the message.

This is on Mac OSX 10.13.6 with iTerm2.

ā‹Š> brew --version
Homebrew 2.1.4
Homebrew/homebrew-core (git revision 97b15a; last commit 2019-06-07)
Homebrew/homebrew-cask (git revision 2a010; last commit 2019-06-07)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionakalizaView Question on Stackoverflow
Solution 1 - MacosomikesView Answer on Stackoverflow
Solution 2 - MacoskalibrainView Answer on Stackoverflow
Solution 3 - MacoschenxuZhuView Answer on Stackoverflow
Solution 4 - MacosZakariah SiyajiView Answer on Stackoverflow
Solution 5 - MacospbaranskiView Answer on Stackoverflow
Solution 6 - MacosEmilie YView Answer on Stackoverflow
Solution 7 - MacosAure77View Answer on Stackoverflow
Solution 8 - MacosPysisView Answer on Stackoverflow