Error trying to install mongodb with brew - homebrew

When installing mongodb with brew I get 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
[BorisGrunwald#boriss-mbp Downloads]$
Anyone know what might be the cause for this?

Colin, brew not support sudo anymore.
Boris try this:
sudo mkdir /usr/local/Frameworks
sudo chown -R $(whoami) /usr/local/Frameworks
brew link --overwrite python#2

brew is not having write permissions for /usr/local directory.
Try changing the permission using below command
sudo chown -R : *

try unsing sudo to set the Permissions :
sudo brew install ...

Related

how can I solve the brew link wget /usr/local/share/locale/bg/LC_MESSAGES not writable problem? chown chmod did not work

I installed wget with brew install wget, and tried to link with brew link wget. Then I got Error: Could not symlink share/locale/bg/LC_MESSAGES/wget-gnulib.mo /usr/local/share/locale/bg/LC_MESSAGES is not writable.
Trying sudo chown -R jinglin:admin /usr/local/share/locale/be/LC_MESSAGES and sudo chmod a+rwx /usr/local/share/locale/be/LC_MESSAGES did not help.
Anyone had the same problem and know how to solve? Thanks a lot!
In case someone run into the same issue, this line solved my problem:
sudo chown -R $(whoami) $(brew --prefix)/*

Homebrew error when installing neovim, how to solve this issue?

I want to install neovim but I'm getting the following error:
Permission denied # dir_s_mkdir - /usr/local/share
How can I fix this?
Recommended solution:
$ sudo install -d -o $(whoami) -g admin /usr/local/share
A not-so-elegant solution to give permission:
$ sudo chown -R $(whoami) $(brew --prefix)/*

Getting this error while installing nifi on mac- HighSierra

I am using command brew install nifi and am getting error:
Error: *Could not create /usr/local/Cellar
Check you have permission to write to /usr/local*
How can I fix it?
sudo chmod a+w /usr/local/Cellar
This adds write permissions for all to /usr/local/Cellar. To add propagate the change to subfolders, add -R.
sudo chmod -R a+w /usr/local/Cellar

How do I fix 'brew install pkg-config'?

Warning: Could not link pkg-config. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link pkg-config`‏‏‏‏‏‏
brew reinstall pkg-config
rm -R offending-directory
repeat step 1
As Michael Pigg said above, in my case it was the folder permission issue.
I had to do the following:
sudo chmod 777 /usr/local/bin
sudo chmod 777 /usr/local/share/man/man1
brew link pkg-config
And after I'm done:
sudo chmod 755 /usr/local/bin
sudo chmod 755 /usr/local/share/man/man1
to restore the original permissions.
It may be a permissions issue on /usr/local/share. You need to have write permission in that directory for the link to complete. However, zsh will complain about the directory being insecure if you set the write permission. I gave the write permission to allow pkg-config to install and then removed it so that zsh would be happy.
reinstall command line tools: https://developer.apple.com/downloads/index.action
brew link --overwrite --dry-run pkg-config

Homebrew Symlink Error

I am trying to install memcached using:
brew install memcached
This ends in error about homebrew not being able to create a symlink:
The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
Help!
I uninstalled what homebrew had so far installed (libevent dependency):
brew uninstall libevent
Then chow-ned the usr/local directory:
sudo chown -R $(whoami) /usr/local
Then tried to install memcached again and it worked:
brew install memcached
As of High Sierra, /usr/local is no longer chown-able. The new procedure suggested in a Homebrew issue is:
sudo chown -R $(whoami) $(brew --prefix)/*
FYI: If required /usr/local subfolders (e.g. ./include or ./Frameworks) are missing, you'll have to mkdir them first
Thanks for updating your own question this helped me a lot. I fixed this issue by making all locations in /usr/local writable to group as I am already in the admin group.
To do this just use the following command
sudo chmod -R g+w /usr/local
after i performed the suggestions in #septerr answer, i still was unable to install carthage via homebrew... after some googleing i found this: Gist https://gist.github.com/dalegaspi/7d336944041f31466c0f9c7a17f7d601
Anyway... got this:
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
did this:
sudo chown -R $(whoami) $(brew --prefix)/*
and
sudo install -d -o $(whoami) -g admin /usr/local/Frameworks
after that is was able to install carthage successfully
It seems that since El Capitan the file permissions in /usr/local have been changed, causing the above problem for me.
Instead of the chosen solution I suggest to do a:
sudo chown -R :staff /usr/local
This will work for all users
Symlink errors prevented
brew install pyenv
on macOS Big Sur 11.6.2.
Solution suggested by #sean-denigris worked
sudo chown -R $(whoami) $(brew --prefix)/*
Before this I had tried the solution proposed by #marko
sudo chmod -R g+w /usr/local
that gave the following error
chmod: Unable to change file mode on /usr/local: Operation not permitted

Resources