Another active Homebrew process is already in progress - macos

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?

Try removing the Homebrew process locks with this command:
rm -rf $(brew --prefix)/var/homebrew/locks

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

Simply type the following into your terminal:
brew cleanup
This should clean up any issues. Follow the command with:
brew doctor
All done.

just close the terminal and reopen another

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

To unlock with any homebrew install location:
rm -rf $(brew --prefix)/var/homebrew/locks

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

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)

Home brew itself gave a suggestion to run the below command and give permissions to the user.
sudo chown -R $(whoami) /opt/homebrew
This worked for me.

Related

Error when installing graphviz on Mac using Homebrew

I am using macOS 11.5.1 Big Sur and I tried to install Graphviz via
brew install graphviz
but I got an error:
Error: python#3.9: wrong number of arguments (given 1, expected 0)
The version of my Homebrew is
Homebrew 3.0.5
Homebrew/homebrew-core (git revision 7ff3c752de; last commit 2021-08-13)
Homebrew/homebrew-cask (git revision af069ca1b1; last commit 2021-08-13)
I have no idea about the reason. Any suggestions? Thank you.
I have fixed this issue, by the following commands.
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --switch /Applications/Xcode.app
Then rerun the brew install:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
It works on my Mac. Just share in case that anyone encounters the same issue.
I was unable to get it to work with homebrew. I read other threads recommending trying with Ports, which I did and failed also, since I got a little farther with Ports, I continue to look and finally found this...
Uninstall graphiz if you tried homebrew: brew uninstall graphviz
Install Ports https://www.macports.org/install.php
edit the Ports installation https://www.macports.org/install.php
Edit opt/etc/macports/sources.conf, comment out the rsync entry, and add a new entry as follows:
#rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
https://distfiles.macports.org/ports.tar.gz [default]
Run sync in debug mode and watch for the tarball being used instead of rsync:
sudo port -d sync
sudo port install graphviz

Can't install homebrew

I have a fairly new macbook pro and I'm simply trying to install homebrew according to the directions on their site:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
However, when I run this I get the following output:
The user \u cannot be found
There was an unknown error.
This script requires the user \u to be an Administrator.
My macbook only has 1 user, which is me, the Administrator. That's who I'm logged in as on the computer.
Another thing I've tried is running the command with sudo, in which case I get the following message:
Don't run this as root!
Another thing I've tried is downloading Command Line Tools (CLT) for Xcode: xcode-select --install as I saw this suggested on Homebrew's site and elsewhere online.
After creating a new user with "Admin" privileges apart from my root account, the homebrew install command above started to run but then quit with the following error:
/usr/local/homebrew/.git: Permission denied
Failed during: git init -q
At this point I'm stuck and not sure what to do.
I was able to install Homebrew using the following steps. Note I did this on a non-root admin user account. I had to create this user account separately and give it admin access just to do this. Once I logged out of my root account and logged into the admin non-root account, I typed the following commands into terminal:
xcode-select --install
cd /usr/local/Homebrew
git init
git remote add origin https://github.com/Homebrew/brew
git fetch --all
git checkout -B master origin/master
cd /usr/local
ln -s /usr/local/Homebrew/bin/brew /usr/local/bin
I found most of these steps here:
https://github.com/Homebrew/homebrew-core/issues/5084#issuecomment-248834806
Hope this helps someone else.
Have you tried installing Xcode first?
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then see if the installation was correct with "brew doctor"
Source: https://www.howtogeek.com/211541/homebrew-for-os-x-easily-installs-desktop-apps-and-terminal-utilities/
Uninstall and reinstall reinstall Homebrew.
Run sudo chown -R $USER /usr/local and then reinstall

Installing MongoDB

I get this error when installing MongoDB on OSX, even though the second time I tried it with sudo command. Any thought?
==> Checking out tag r3.0.3
==> ./build.sh
==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/3.0.3 -j4 --osx-version-min=10.9 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --use-new-tools
Error: Permission denied - /usr/local/var/mongodb
Monas-MacBook-Pro:meanio mona$ sudo brew install mongodb
Password:
Error: Cowardly refusing to `sudo brew install`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
It's a permissions problem. The solution being:
sudo chown -R `whoami` /usr/local/var/mongodb
Per the comment:
Try creating the directory, prior to setting ownership:
sudo mkdir /usr/local/var/mongodb && sudo chown -R `whoami` /usr/local/var/mongodb
I just open /usr/local/ via finder and manually create folder with name var. Mac asked for a password. After that I successfully install MongoDB.
You shouldn't use brew with sudo. To check the overall brew sanity, run:
$ brew doctor
It will pinpoint potencial problems and it's corresponding solutions. If it really is a permission problem, as pointed by #hd1, you should fix the permissions of /usr/local/var/, where brew is trying to create the /mongodb folder.

Install git via homebrew on mac osx 10.10 results in: Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2

Hi I just tried installing git via homebrew on my mac - something is wrong. I had the github for mac app installed, but I tried removing that. The current git version in my system is:
Nielsk#~: $ git --version
git version 1.9.3 (Apple Git-50)
This is what happens if I try to install git via homebrew:
Nielsk#~: $ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.1.3.y
######################################################################## 100,0%
==> Pouring git-2.1.3.yosemite.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
How can I solve this?
I also met the same issue. I think we should change the readable permission to make sure any of the directories is readable by "all". So I tried the command: sudo chown -R $USER:admin /usr/local
and then: brew link --overwrite git It works for me, hope it will also work for you.
From High Sierra, chown of /usr/local is not allowed. However you can still change permission the sub directories in /usr/local.
In my case, I had to create Frameworks in /usr/local and sudo chown -R $(whom) Frameworks. After that follow what brew doctor says.
The better way is to create subdirectory whatever you need and run
sudo chown -R $(whoami) $(brew --prefix)/*
For those with the new El Capitan OS, you'll need to update your permissions:
Open Terminal and type the following commands:
$ sudo chown -R $(whoami):admin /usr/local
$ brew doctor
$ brew update
$ brew link --overwrite git
The above solution will work for other brew installs like node, etc. Just replace the last line if you started the installation but encountered errors during the brew installation.
I had a similar permission denied error on install of git until I cleaned things up:
$brew doctor
..... << long output of issues, so you run:
$brew prune
$brew doctor
..... << less issues now, so manually clean up
$brew update
$brew install git
Does that address your error as well?
I did what brew doctor recommended and it helped:
sudo mkdir -p /usr/local/sbin
sudo chown -R $(whoami) /usr/local/sbin
MacOS 10.14.4

Homebrew is halfway installed. Can't re-install or uninstall - How can I manually uninstall?

I seem to have dug myself into a corner.
I was halfway through installing Homebrew the first time and it got stuck. After ~15 minutes of waiting I quit terminal. My original input was what's from the homebrew homepage.
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
I reopened terminal and tried to re-install and got -
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
So, as suggested, I ran
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
and got
-bash: brew: command not found
I tried to run the uninstall script from the Homebrew FAQ and that didn't seem to help either. Anything else I can try? How would I manually uninstall?
So what happens now if you run ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" again?
After you killed terminal did you ps auxw | grep -E 'ruby|curl' and kill those?
Are you using /usr/local for anything else? If not, you can rm -rf /usr/local and run the install command again.
I'm not a pro at terminal but I found a line in my .gitconfig that prevented me from running the install:
[push]
default = simple
After commenting that line out of my .gitconfig the install ran beautifully.
If you run rm -rf /usr/local you might get permission denied or risk deleting files of other installed programs. Deleting only /usr/local/Homebrew/ folder worked for me

Resources