After installing and uninstalling some programs through brew and brew cask, now I get brew doctor saying "unlinked kegs in your Cellar".
It suggests to link them, to avoid build trouble with later brews, but instead I'd rather delete them, as they're leftovers from brew programs or formulas that I don't use anymore.
How or where do I remove these? (I don't even know what a keg, or the Cellar, is)
Run:
brew remove packageName
for each unlinked package.
2018 Update
$ brew link --help
If --overwrite is passed, Homebrew will delete files which already exist
in the prefix while linking.
$ brew link --overwrite [package]
$ brew doctor
running brew link will bring up optional commands that you can use, along with that you'll need an argument to go with it or it'll prompt you with an error saying just that.
so I would suggest running:
brew doctor
This will give you the:
'Warning: You have unlinked kegs in your Cellar...'
message
underneath this message it will prompt which kegs are there with the potential problem.
My personal warning was:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
mongodb
brew link
read your options, so you understand what is happening with this command.
brew link --dry-run <yourArgument>
Homebrew will list all files which would be linked or which would be deleted by brew link --overwrite, but will not actually link or delete any files.
brew link --overwrite <yourArgument>
This will execute what the dry-run did, for real this time.
My experience with this was:
cli cmnd:brew link --overwrite mongodb
cli response: Linking /usr/local/Cellar/mongodb/3.2.7... 0 symlinks created
brew doctor
Finally I ran this command and my response no longer had issues.
cli response: Your system is ready to brew.
I figure it will either make the link or if there is none to be had it will just delete the file; which was a previous solution above (this just seems to follow the brew cli prompts vs. just "smashing" the issue with a hammer).
I hope this helps you!
don't cry over spilt code, keep supporting the community.
After installing homebrew on Mac I had the following error:
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
libtool
libksba
libyaml
libgpg-error
After running brew link libtool I would get the following error:
$ brew link libtool
Linking /usr/local/Cellar/libtool/2.4.6_1...
Error: Could not symlink include/libltdl
/usr/local/include is not writable.
But as it turned out I didn't have a folder /usr/local/include at all.
So I created it. And then changed the owner and group of the new folder to match the other folders in /usr/local. The next error was the same for /usr/local/lib, so I followed the same process.
After creating those two folders, brew link [package] worked.
brew 1.9.0
brew cleanup [options] [formula|cask]
Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks.
--prune Remove all cache files older than specified
days.
-n, --dry-run Show what would be removed, but do not
actually remove anything.
-s Scrub the cache, including downloads for
even the latest versions. Note downloads
for any installed formula or cask will
still not be deleted. If you want to delete
those too: rm -rf "$(brew --cache)"
--prune-prefix Only prune the symlinks and directories
from the prefix and remove no other files.
-v, --verbose Make some output more verbose.
-d, --debug Display any debugging information.
-h, --help Show this message.
Older versions
brew prune [--dry-run]:
Remove dead symlinks from the Homebrew prefix. This is generally not
needed, but can be useful when doing DIY installations. Also remove broken
app symlinks from /Applications and ~/Applications that were previously
created by brew linkapps.
If --dry-run or -n is passed, show what would be removed, but do not
actually remove anything.
rm /usr/local/Library/Taps/josegonzalez
-or if you are frightened-
mv /usr/local/Library/Taps/josegonzalez /usr/local/Library
Alike for other conflicting, but unlinked kegs/taps.
You can also use the provided info from the console and link them again:
Run `brew link`
Do this for each item listed, and everything should be fixed soon.
Related
Please help understand what is going on--or whether any action is required. I've gone through a lot of posts on dealing with brew, node, symlink, uninstalled and reinstalled node, npm, yarn, tried brew cleanup. When brew doctor produced these warnings--
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/lib/node_modules/npm/node_modules/.bin/JSONStream
/usr/local/lib/node_modules/npm/node_modules/.bin/errno
/usr/local/lib/node_modules/npm/node_modules/.bin/is-ci
/usr/local/lib/node_modules/npm/node_modules/.bin/node-gyp
/usr/local/lib/node_modules/npm/node_modules/.bin/opener
/usr/local/lib/node_modules/npm/node_modules/.bin/qrcode-terminal
/usr/local/lib/node_modules/npm/node_modules/.bin/rc
/usr/local/lib/node_modules/npm/node_modules/.bin/semver
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-conv
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-sign
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-verify
/usr/local/lib/node_modules/npm/node_modules/.bin/uuid
/usr/local/lib/node_modules/npm/node_modules/.bin/which
When I tried brew prune, I got:
newmbp$ brew link node
Warning: Already linked: /usr/local/Cellar/node/10.11.0
I noticed the files (to be linked or unlinked) are in separate folders, but have been struggling to understand the implications of having files in /usr/local/Cellar vs in /usr/local/lib
The precipitating factor that led to all of this was the fan on my laptop runs furiously from time to time, often while MAMP is running.
brew cleanup --prune-prefix (ex- brew prune) removed the broken symlinks, so the issue should be gone.
The fact that brew link node complains has nothing to do with this; it’s a completely different command. It’s not even an error, just a warning: "you asked me to link node but it’s already linked" so everything’s fine here.
Homebrew installs its files in /usr/local/Cellar. On the other hand, /usr/local/lib is a shared directory commonly used for libraries. In order for software to find libs Homebrew installed, it symlinks them in it.
For example, let’s say you have a formula foo version 1.2.3 that installs a library bar. After running brew install foo you should get something like this:
# the library files
/usr/local/Cellar/foo/1.2.3/lib/bar
# a symlink to the library files from /usr/local/lib
/usr/local/lib/bar -> /usr/local/Cellar/foo/1.2.3/lib/bar
If you brew uninstall foo, it removes both the library files and the symlink.
Those Homebrew symlinks can be manipulated with brew unlink <formula> (remove them) and brew link <formula> (add them). brew install runs brew link for you so you don’t need to. This is the reason why you get a warning: your Node symlinks already exist.
brew doctor performs various checks, including check_for_broken_symlinks. This one looks into directories such as /usr/local/var or /usr/local/lib for broken symlinks. A broken symlink is a symlink whose target doesn’t exist, often because it has been removed.
The important point to understand here is that Homebrew looks at all symlinks, not just the ones it created. Broken symlinks may cause issues, which is why Homebrew warns you about them, but if everything’s working fine for you feel free to ignore the warning.
Im trying to install Odoo v9 on macOS Sierra. I got it installed under virtualenv but when I run it (odoo.py) I get a Could not execute command lessc. I found this:
https://dedyyuristiawan.blogspot.com/2016/07/installation-odoo-on-mac-os-x-error.html
but when i try to run sudo brew ... I get this error:
Error : Running Homebrew as root is extremely dangerous and no longer supported.
I ran it without sudo but I get:
Error: Permission denied - usr/local/lib/node_modules/npm/.github/issue_template.md
When I run brew doctor I get:
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Users/mars/odoo-env/bin/python-config
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
node
So I ran this:
(odoo-env) Marcios-MacBook-Pro:odoo mars$ brew cleanup
(odoo-env) Marcios-MacBook-Pro:odoo mars$ brew link node
Linking /usr/local/Cellar/node/7.2.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
(odoo-env) Marcios-MacBook-Pro:odoo mars$ brew cleanup
(odoo-env) Marcios-MacBook-Pro:odoo mars$ brew link node
Linking /usr/local/Cellar/node/7.2.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
Anyone know a workaround?
Execute this and youre fine:
sudo chown -R $(whoami):admin /usr/local/lib/node_modules/
Forgive me if this is elsewhere, but I can't find it.
I am trying to install NTFS-3G on OS X 10.11 (El Capitan).
I am following the process at this link
But the step to install NTFS-3G reports:
$ brew install homebrew/fuse/ntfs-3g
Warning: homebrew/fuse/ntfs-3g-2015.3.14 already installed, it's just not linked
So...
How do I just link the installed item?
Once that's done, how do I complete the install process? Is there anything that the 'brew install...' process would do after linking?
EDIT:
Following bfontaine... I get:
$ brew link homebrew/fuse/ntfs-3g
Linking /usr/local/Cellar/ntfs-3g/2015.3.14...
Error: Could not symlink share/doc/ntfs-3g/README
Target /usr/local/share/doc/ntfs-3g/README
already exists. You may want to remove it:
rm '/usr/local/share/doc/ntfs-3g/README'
To force the link and overwrite all conflicting files:
brew link --overwrite ntfs-3g
To list all files that would be deleted:
brew link --overwrite --dry-run ntfs-3g
$ brew link --overwrite homebrew/fuse/ntfs-3g
Linking /usr/local/Cellar/ntfs-3g/2015.3.14...
Error: Could not symlink share/doc/ntfs-3g/README
/usr/local/share/doc/ntfs-3g is not writable.
Am I going down a hole? If I brew uninstall, will it clean everything up, or do I have to manually clean it up?
This is getting messy...
EDIT2:
The output of brew link --overwrite --dry-run is:
$ brew link --overwrite --dry-run homebrew/fuse/ntfs-3g
Would remove:
/usr/local/include/ntfs-3g/acls.h
/usr/local/include/ntfs-3g/attrib.h
/usr/local/include/ntfs-3g/attrlist.h
/usr/local/include/ntfs-3g/bitmap.h
/usr/local/include/ntfs-3g/bootsect.h
/usr/local/include/ntfs-3g/cache.h
/usr/local/include/ntfs-3g/collate.h
/usr/local/include/ntfs-3g/compat.h
/usr/local/include/ntfs-3g/compress.h
/usr/local/include/ntfs-3g/debug.h
/usr/local/include/ntfs-3g/device.h
/usr/local/include/ntfs-3g/device_io.h
/usr/local/include/ntfs-3g/dir.h
/usr/local/include/ntfs-3g/ea.h
/usr/local/include/ntfs-3g/efs.h
/usr/local/include/ntfs-3g/endians.h
/usr/local/include/ntfs-3g/index.h
/usr/local/include/ntfs-3g/inode.h
/usr/local/include/ntfs-3g/ioctl.h
/usr/local/include/ntfs-3g/layout.h
/usr/local/include/ntfs-3g/lcnalloc.h
/usr/local/include/ntfs-3g/logfile.h
/usr/local/include/ntfs-3g/logging.h
/usr/local/include/ntfs-3g/mft.h
/usr/local/include/ntfs-3g/misc.h
/usr/local/include/ntfs-3g/mst.h
/usr/local/include/ntfs-3g/ntfstime.h
/usr/local/include/ntfs-3g/object_id.h
/usr/local/include/ntfs-3g/param.h
/usr/local/include/ntfs-3g/realpath.h
/usr/local/include/ntfs-3g/reparse.h
/usr/local/include/ntfs-3g/runlist.h
/usr/local/include/ntfs-3g/security.h
/usr/local/include/ntfs-3g/support.h
/usr/local/include/ntfs-3g/types.h
/usr/local/include/ntfs-3g/unistr.h
/usr/local/include/ntfs-3g/volume.h
/usr/local/include/ntfs-3g/xattrs.h
/usr/local/share/man/man8/mkfs.ntfs.8 -> /usr/local/share/man/man8/mkntfs.8
/usr/local/share/man/man8/mkntfs.8
/usr/local/share/man/man8/mount.lowntfs-3g.8 -> /usr/local/share/man/man8/ntfs-3g.8
/usr/local/share/man/man8/mount.ntfs-3g.8 -> /usr/local/share/man/man8/ntfs-3g.8
/usr/local/share/man/man8/ntfs-3g.8
/usr/local/share/man/man8/ntfs-3g.probe.8
/usr/local/share/man/man8/ntfs-3g.secaudit.8
/usr/local/share/man/man8/ntfs-3g.usermap.8
/usr/local/share/man/man8/ntfscat.8
/usr/local/share/man/man8/ntfsclone.8
/usr/local/share/man/man8/ntfscluster.8
/usr/local/share/man/man8/ntfscmp.8
/usr/local/share/man/man8/ntfscp.8
/usr/local/share/man/man8/ntfsfix.8
/usr/local/share/man/man8/ntfsinfo.8
/usr/local/share/man/man8/ntfslabel.8
/usr/local/share/man/man8/ntfsls.8
/usr/local/share/man/man8/ntfsprogs.8
/usr/local/share/man/man8/ntfsresize.8
/usr/local/share/man/man8/ntfsundelete.8
/usr/local/lib/libntfs-3g.86.dylib
/usr/local/lib/libntfs-3g.a
/usr/local/lib/libntfs-3g.dylib -> /usr/local/lib/libntfs-3g.86.dylib
/usr/local/lib/pkgconfig/libntfs-3g.pc
$
but even after 'brew uninstall...' the directory /usr/local/include/ntfs-3g still exists
Use brew link homebrew/fuse/ntfs-3g.
To go further here are the common commands relevant here:
brew install <formula> # install (and link) the formula
brew unlink <formula> # unlink the formula
brew link <formula> # link the formula
brew uninstall <formula> # uninstall (and unlink) the formula
To understand this you need to know that when Homebrew installs a formula foo version 1.2.3, it installs everything under /usr/local/Cellar/foo/1.2.3/ then symlinks all binaries in /usr/local/bin; all manpages under /usr/local/share/man; etc. This means that /usr/local/bin/something is not a binary but a symlink to the relevant binary (e.g. /usr/local/Cellar/foo/1.2.3/bin/something).
Sometimes binaries conflict with each other. For example both mysql and mariadb provide a mysql binary. Homebrew won’t be able to link both at the same time so it allows you to install one; unlink it; then install the other. That way you can have both on your system without conflict.
When I run brew doctor, the following error is thrown
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/curl/curl.h
/usr/local/include/curl/curlbuild.h
/usr/local/include/curl/curlrules.h
/usr/local/include/curl/curlver.h
/usr/local/include/curl/easy.h
/usr/local/include/curl/mprintf.h
/usr/local/include/curl/multi.h
/usr/local/include/curl/stdcheaders.h
/usr/local/include/curl/typecheck-gcc.h
/usr/local/include/node/ares.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/nameser.h
/usr/local/include/node/node.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_internals.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/uv-private/ngx-queue.h
/usr/local/include/node/uv-private/stdint-msvc2008.h
/usr/local/include/node/uv-private/tree.h
/usr/local/include/node/uv-private/uv-bsd.h
/usr/local/include/node/uv-private/uv-darwin.h
/usr/local/include/node/uv-private/uv-linux.h
/usr/local/include/node/uv-private/uv-sunos.h
/usr/local/include/node/uv-private/uv-unix.h
/usr/local/include/node/uv-private/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-preparser.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8stdint.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
Would it be safe to delete these files? What is the optimal way to resolve this warning?
It looks like you installed curl and nodejs without using homebrew.
You have two options:
Do nothing except remember this forever, so that you don't think they are from homebrew and wonder why homebrew is complaining.
Remove them and install nodejs and curl from homebrew.
1 is the easy way, until it isn't.
I recommend #2 because it is likely, in the future you will install something from homebrew which depends on curl and/or node and homebrew will attempt to install those dependencies. When building from source, wrong headers may get used and mismatch libraries being linked. This is not fun to debug.
If those non homebrew header files are there for a reason and you are compiling software with them, then you are probably able to put them back if you need them. If you aren't building software with them, then you don't need them. Go ahead and delete them for now.
You can skip the stray header checks to make it easier to see if there are issues other than node/npm not playing nicely with homebrew
brew doctor `brew doctor --list-checks | grep -v stray_headers`
It may be safe to leave those files in place unless you encounter build or link problems with other Homebrew formulas; brew doctor output is advisory, not normative.
If you don't think you have a reason to build against the versions of curl or node in /usr/local, you can remove those header files; you can always reinstall the newest version later with Homebrew.
I would copy them into a file (tmpKill), and then run:
xargs -0 -n 1 rm -rf < <(tr \\n \\0 <tmpKill)
This makes it easy to kill them all. The leftmost command generates a set of lines on which the rm -rf command (which deletes the files) is run. The -n directive ensures that the command (rm -rf) is only run once per entry.
I had this same error today (Nov 19 2021) and I found out this discussion on GitHub which helped fixing it. https://github.com/Homebrew/discussions/discussions/1512
I actually got 3 warnings:
Warning: Homebrew/homebrew-core was not tapped properly! Run:
rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
git -C $(brew --repo homebrew/core) checkout master
I ran these 2 commands and it fixed the problem:
> rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core"
> brew tap homebrew/core
This solution worked for me!
sbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. 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 phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.