brew doctor is telling me about some header and library files in /usr/local/lib that I want to keep and are perfectly expected - is there a way I can tell brew doctor to not warn me about these?
I do not know of a way of "white-listing" for brew doctor things that you are already aware of and happy to accept. I can only suggest you use an inverse grep to filter them out, e.g.:
brew doctor 2>&1 | grep -v "stuff I know about"
So, if you know about packageXYZ, try:
brew doctor 2>&1 | grep -v "packageXYZ"
See also this answer.
Related
I want the short description in combination with brew list or brew list --cask like in /api/formula.json on my installed brew packages.
Is this somehow possible?
brew desc $(brew list)
or formatted in columns with
brew desc --eval-all $(brew list) | awk 'gsub(/^([^:]*?)\s*:\s*/,"&=")' | column -s "=" -t
does the trick. thanks to carlocab:
https://github.com/Homebrew/brew/issues/14244#issuecomment-1346909437
Previously I've had things installed with homebrew which had dependencies which I omitted to remove when I removed the package itself (homebrew of course does not do this automatically for you, for good reason).
Now, to tidy up my system a bit, I'd like to identify all the brew packages which are not required by any other that is installed, so that I can manually identify those which I want to keep vs. those I am happy to remove.
To do this manually, I would do brew list, then, on each item which that outputs, I would do brew uses --installed <name-of-package-from-brew-list>, to check with respect to each package whether it is used by any other installed package (Then, if the answer is none, if I was curious as to why it was originally installed, I could also do brew uses <name-of-installed-package> which might indicate to me which package I used in the past but have since uninstalled actually installed it originally).
This is all very manual and I wondered if xargs could help.
My attempt to use it isn't working:
brew list | xargs brew uses --installed > test.txt
I get no output at all from that command, a blank file (but the command takes several seconds to run).
What am I not doing right with xargs?
It seems like brew leaves would fit your use-case?
% brew leaves --help
Usage: brew leaves
List installed formulae that are not dependencies of another installed formula.
From the question:
brew list | xargs brew uses --installed > test.txt
This command should be spelled xargs -n1 since brew uses with multiple formulae does something quite different:
% brew uses --help
Usage: brew uses [options] formula
Show formulae that specify formula as a dependency. When given multiple
formula arguments, show the intersection of formulae that use formula. By
default, uses shows all formulae that specify formula as a required or
recommended dependency for their stable builds.
brew autoremove --dry-run
Removes all packages that were only installed as a dependency of another formula and are now no longer needed. With the --dry-run flag you can dry run it and just get a list of all packages without uninstalling anything.
When I upgrade software in homebrew, I got the following warning:
➜ ~ brew upgrade
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Homebrew/Library/Homebrew/formula.rb:2373:in `fails_with'
I guess this issue has some relation with julia programming language I installed a few weeks ago, but julia has been removed. How can I fix this problem?
Update:
Problem solved by ➜ ~ brew list | grep julia | xargs brew remove
Thanks a lot for #bfontaine's hints.
I had the same error, but from a different formula (a deprecated vpnc installed on an old computer).
A generic solution for others without julia who've also found this problem is to find the formulae with the deprecated compiler:
grep -R "fails_with :llvm" $(brew --cellar)
brew remove #{formula from above}
(These are instructions for the answer in https://github.com/Homebrew/homebrew-services/issues/131. Credit to bfontaine's initial comments, but that was looking at taps)
This is due to the staticfloat/julia tap (= a third-party repository for additional formulae) you had to use in order to install Julia. You uninstalled Julia but kept the tap, so those errors are still there.
The tap authors are aware of the issue and removed those fails_with calls today; you should be fine after a brew update.
Given you don’t need that tap anymore you might also want to remove it:
brew untap staticfloat/julia
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.
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.*