自制符号链接错误

我试图安装 memcached 使用:

brew install memcached

结果是自制程序无法创建符号链接:

The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local

救命啊!

38970 次浏览

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

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

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

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

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

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