Brew install not working on watchman - installation

I am on a mac os high sierra, and typing to install watchman
Kishores-MacBook-Pro:~ kishore$ brew install watchman
Error: Could not create /usr/local/Cellar
Check you have permission to write to /usr/local
Kishores-MacBook-Pro:~ kishore$ sudo chown -R $USER /usr/local
chown: /usr/local: Operation not permitted
Kishores-MacBook-Pro:~ kishore$

Related

Cannot install homebrew packages because permission is denied

When I run brew install {package}, I get the following:
ln: /usr/local/bin/{package}: Permission denied
But if I try to use sudo brew install {package}, I get the following:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
How do I get homebrew working again?
You can fix permissions for Homebrew by running:
cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks
See this answer for details: https://stackoverflow.com/a/44208097/1807667

Homebrew instillation failed

I get this error when trying to install homebrew:
chmod: Unable to change file mode on /usr/local/share/zsh: Operation not permitted
chmod: Unable to change file mode on /usr/local/share/zsh/site-functions: Operation not permitted
Failed during: /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
(macos 10.15.7)
Give this a try:
sudo chown -R $(whoami) $(brew --prefix)/*
Also, brew doctor would help you with your brew usage.

brew update Error: The /usr/local directory is not writable. sudo chown -R $(whoami):admin /usr/local not working

I am getting this error:
jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$
For some reason, it is not letting me to change the ownership and permissions of /usr/local.
From High Sierra you cannot change ownership of /usr/local.
Use:
sudo chown -R $(whoami) $(brew --prefix)/*

brew update fails with "Permission denied" error

I have been trying to upgrade my brew installation on Mac and it always fails with the following error:
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied # dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied # dir_s_mkdir - /usr/local/Frameworks
I do not want to run brew as sudo, but is there a way to fix this error? I'm not able to install Python3 which is my ultimate goal. Is there another way to install Pythion3 on Mc other than brew? Is there any resolution for this problem here?
EDIT: I tried to remove python3 and tried to re install it again and this time it fails with some other message:
==> Pouring python-3.6.5.high_sierra.bottle.1.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied # dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied # dir_s_mkdir - /usr/local/Frameworks
Try to change owner of /usr/local.
if you use macOS High Sierra or higher try this command:
sudo chown -R $(whoami) $(brew --prefix)/*
if you use macOS Sierra or lower:
sudo chown -R $(whoami) /usr/local
In Mac OSX Mojave, installing Python3, I solved this issue by the following:
sudo mkdir /usr/local/Frameworks
sudo chown -R user:group /usr/local/Frameworks/
brew link python
Where user and group are specified as set by the OS. You can find out what user/group values should be by doing:
ls -al /usr/local
And then python3 was successfully installed:
> python3
Python 3.7.2 (default, Feb 12 2019, 08:15:36)
[.Clang 10.0.0 (clang-1000.11.45.5)] on darwin

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

Resources