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
Related
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.
i have tried sudo chown $whoami /usr/local/bin , after closing terminal and reopening terminal but it keeps getting permission denied, it doesn't fix it permanently.
shaunstanislaus#Master ~ $ brew upgrade
==> Upgrading 3 outdated packages, with result:
git 2.6.1, mysql 5.6.27, node 4.1.2
==> Upgrading git
Error: Permission denied - /usr/local/share/git-core
You will need to chown (change ownership) of the /usr/local/bin /usr/local/share, /usr/local/share/man and /usr/local/share/man/man1 directories.
To do this you do the following:
whoami - this will give you your current username
sudo chown -R 'username' /usr/local/bin /usr/local/share /usr/local/share/man /usr/local/share/man/man1 (replace username with the username from step 1)
Now run brew doctor
You shouldn't see any issues.
Then run brew upgrade
If you are using Sophos Anti-Virus, the permissions will be reset each time Sophos updates in the background.
They are pursuing a fix for this and will be in place by mid Nov 2015 according to this forum post:
https://community.sophos.com/products/free-antivirus-tools-for-desktops/f/17/t/10029
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.
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
I installed ruby via \curl -L https://get.rvm.io | bash -s stable and did rvm install 1.9.2 doing this creates and error
Installing requirements for osx, might require sudo password.
fatal: Unable to create '/usr/local/.git/index.lock': Permission denied
Error: Failure while executing: git checkout -q master
Failed to update Homebrew, follow instructions here:
https://github.com/mxcl/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.
Upon doing a which git it shows it's installed in /usr/bin/git yeah homebrew keeps trying to reference /usr/local/.git. I tried unistalling homebrew so I can do a fresh install using what's listed at homebrew gist. All seemed well but doing a which brew still shows it as /usr/local/bin/brew so I tried to manually uninstall it by doing it one by one.
One thing to note is I never had a Cellar folder, why I don't know. While doing a brew prune I noticed a lot of macport items are starting to ask if I should override them.
Is it typical to of ran the uninstall script but still have the brew commands available or the dirs?
Why is it that homebrew needs root access to /user/local/ to work, this is extremely bad.
That /usr/local/.git it's referencing is not the git executable, but the config file for the repository it's trying to set up under /usr/local/. It's trying to write to that file.
To run homebrew you need write permissions to /usr/local as the user you'r going to run brew as. Homebrew's recommended method is to adjust the ownership and permissions on /usr/local to allow you to write to it from your regular user account or a dedicated homebrew account, instead of using sudo. This is done as part of the homebrew installation script, typically by putting you in the admin group and making /usr/local group-writable.
To fix this, check the owner and permissions on /usr/local/ and /usr/local/.git and make sure you can write to them (and the rest of the /usr/local/ hierarchy) as the user that you're running brew and RVM commands as.
Ended up just doing a sudo $USER as I really could not find any other approach to fixing this.