Is it possible to combine homebrews "brew list" with another command or argument to get the short description on all installed packages? - homebrew

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

Related

Can I tell brew doctor to ignore some files

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.

Homebrew find installed packages which aren't dependencies of any other installed package

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.

brew doctor Error: "No available formula with the name "pkg-config" "

I just installed Homebrew on Windows using the Linux Bash Shell but I have this error when I run brew doctor :
Error: No available formula with the name "pkg-config"
what can i do?
First, update Homebrew so it is pulling from the right resources: brew update
Run brew doctor again.
If the same error occurs, try doing a brew search pkg-config and see which results come up. I've had cases where the path to the package was different than usual. Pick one of the search results, and then do a brew install with the package path from the search results: brew install /homebrew/searchresultpath/pkg-config
Hopefully the correct path for the extension will solve your problem.

How to link ntfs-3g with homebrew?

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.

Brew doctor - "warning: unbrewed header files were found in /usr/local/include"?

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.*

Resources