This repository was archived by the owner on Jan 16, 2025. It is now read-only.
Cannot link --overwrite #19457
Closed
Description
Hello. I cannot link overwrite (i need to remove offending existing files one by one for linking to go through).
I was trying to brew ln libpng --overwrite
I get this error:
Linking /usr/local/Cellar/libpng/1.5.14... Warning: Could not link libpng. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/libpng/1.5.14/share/man/man3/libpngpf.3
/usr/local/share/man/man3/libpngpf.3 may already exist.
/usr/local/share/man/man3 may not be writable.
If I were to remove the file it would not be able to overwrite another one.
I'd like to note that I own /usr/local
(I gave in to this 'advice' after first such issues with Homebrew), Also this is my brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 28d48b450866f2f9fe2127b7905bcd9c511354fa
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.8.3-x86_64
Xcode: 4.6.2
CLT: 4.6.0.0.1.1365549073
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
The contents of my /etc/paths
/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
Activity
dplarson commentedon Apr 26, 2013
It's possible the two files listed may have incorrect permissions even though you own
/usr/local
What's the output of
bmarkovic commentedon Apr 26, 2013
ls -l /usr/local/share/man/man3/libpngpf.3
ls -l /usr/local/share/man/man3
edit2: Just so that I don't leave it hanging:
edit: Btw how can I force brew to work under
sudo
. I just feel awful security-wise to having a user writeable binary folder in the search path regardless of whether it's/usr/local/bin
or something under my home folder. And I can't for the life of me figure out whysudo
is in the dog house.mistydemeo commentedon Apr 26, 2013
Is your entire homebrew install group-owned by wheel?
As long as the
brew
executable is owned by root, you can run Homebrew as root. So if you want, you cansudo chown -R root:wheel /usr/local
andsudo brew
won't complain.Two reasons:
$USER:admin
is the ownership of/Applications
; we chose the same ownership for/usr/local
. Theadmin
group ensures that it's only the users who have sudo permissions who can write into/usr/local
.$USER:admin
ownership and we'd notice, but it's a possibility.dplarson commentedon Apr 26, 2013
Btw, the simplest "fix" for these issue might be to backup the files and directories causing the errors to another location (e.g. your desktop), then remove the files from /usr/local/ and re-try linking the upgraded version.
bmarkovic commentedon Apr 26, 2013
Well none of the apps in
/Applications
can, say, override with a malicioussudo
in/usr/local
that can get summoned by$USER
(who is a sudo-er) and get elevated permissions whereas it can't be all that complicated to keep compiled binaries in user-owned folder and then use elevated permissions only for linking to root owned/usr/local
which would certainly work with all packages since that's how they expect it to be on other *nixen but whatever, it's not my main issue here, and much smarter people than me had this discussion with your chief dev and he didn't change his mind.I have since done the following:
/usr/local
tobmarkovic:admin
(can't make it worse with this anyway).If I don't respond to this thread assume that I've solved my issue with this. Thak you everyone.
mistydemeo commentedon Apr 26, 2013
I understand your concerns, and you're not the only person who prefers to sudo. I wouldn't be opposed to adding the ability to drop permissions during the install method for sudo homebrew installs.
bmarkovic commentedon Apr 29, 2013
Wasn't able to fix the issue itself but I have resolved Homebrew to a working state by three steps above so I will close this.