As my title says, is there a way to see the list of files to be installed before installing the package?
Here is an actual scenario. I wanted the mencoder command. brew search mencoder doesn't show it. I google-searched for it and learned that mencoder usually comes with mplayer. But, I still didn't know whether the mplayer package of homebrew includes mencode or not. (In the end, I went ahead and installed the mplayer package and found the mencoder command in it. After the installation, brew ls mplayer lists the files.)
I imagine that there is a website that shows a "directory" of all the packages . . . (I visited https://formulae.brew.sh/formula/ and searched for mencoder but failed. I looked at the mplayer package but didn't know how to look up its contents.)
Edit: brew info mplayer doesn't show files contained in the package, before or after its installation. brew deps mplayer only shows dependencies between packages. It doesn't show the files contained in a single package.
Does brew info <formula> work for you? (it would list all the dependencies)
brew info mplayer
mplayer: stable 1.5 (bottled), HEAD
UNIX movie player
...
==> Dependencies
Build: pkg-config ✔, yasm ✘
Required: fontconfig ✔, freetype ✔, libcaca ✘
...
or brew deps --graph mpplayer, it would visualize the dependency tree.
update1: update to use mplayer instead of node
Related
When I installed 7zip via home brew (Formula sevenzip), i noticed that i cannot run it via sevenzip and even brew info sevenzip did not tell me the name of the binary.
Only after looking in the script file on Github I noticed a command 7zz but there must be an easier way to find out the binaries or commands associated with a homebrew package.
The simplest I know is:
brew ls PACKAGE
and you can normally see it pretty quickly. Personally, I use p7zip as PACKAGE.
Alternatively, as brew --prefix tells you where binaries are installed (via symlinks), you can find the newest installed binary with:
ls -lrt $(brew --prefix)/bin
and it's the last one listed.
I am cross-compiling on x86_64 MacOS 11 for arm64 architecture.
clang/XCode support it but I face an issue when external library is required.
Let it be boost, for example. I know that the bottle for arm64 is available but it looks like there is no way to select it for installation.
arch -arm64 brew ... says that this architecture is unknown which sounds fair.
So the question is wheather there is an option to force brew install bottles for 'foreign' architecture ?
Thanks to Homebrew team
https://github.com/Homebrew/discussions/discussions/2843
I made it work with the code like this:
setopt sh_word_split
mkdir arm-homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew
alias arm-brew='$(pwd)/arm-homebrew/bin/brew'
response=$(arm-brew fetch --force --bottle-tag=arm64_big_sur boost | grep "Downloaded to")
parsed=($response)
arm-brew install $parsed[3]
Native system brew can be asked to download any desired bottle version with two switches:
--force ignores the compatibility check
--bottle-tag=arm64_big_sur downloads the ARM Big Sur build. This assumes the formula has this build, check the formula .rb for available tags. Big Sur is the earliest macOS with ARM support.
Then use brew --cache to get the filename of the downloaded bottle and pass to brew install:
brew fetch --force --bottle-tag=arm64_big_sur boost
brew install $(brew --cache --bottle-tag=arm64_big_sur boost)
You can verify that it worked with cd $(brew --prefix boost) then use file on any .dylib files to see what architecture they're built for.
If the formula has any dependencies then they will still be installed normally (for the native architecture), so you may have to follow the same process for them.
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.
I've tried hard to install binutil with HomeBrew onto osx 10.11, finally succeed, but objdump still doesn't work. The response given by terminal is as follow:
MacBook-Pro:~ Mars$ brew install binutils
==> Downloading https://homebrew.bintray.com/bottles/binutils-2.26.el_capitan.bo
Already downloaded: /Library/Caches/Homebrew/binutils-2.26.el_capitan.bottle.tar.gz
==> Pouring binutils-2.26.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/binutils/2.26: 109 files, 140.3M
MacBook-Pro:~ Mars$ objdump
-bash: objdump: command not found
Anybody can help?
To avoid conflicts with the utilities distributed by Apple, the binutils executables installed by Homebrew all have "g" prefixed to their names (so, for instance, objdump becomes gobjdump).
you need to update your $PATH to include the homebrew install location. you probably want to look at other places people have asked this question like:
https://superuser.com/questions/324616/how-should-i-set-the-path-variable-on-my-mac-so-the-hombrew-installed-tools-are
Installing:
ostaptan:~ ostap$ brew install imagemagick --disable-openmp --from-source
==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.7-6.tar.bz2
Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.7-6.tar.bz2
==> Patching
patching file configure
Hunk #1 succeeded at 32371 (offset 447 lines).
==> ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.7-6 --enable-shared --disable-static
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link imagemagick'
==> Summary
/usr/local/Cellar/imagemagick/6.7.7-6: 1388 files, 32M, built in 61 seconds
linking after bad linking in install:
ostaptan:wand ostap$ brew link imagemagick
Linking /usr/local/Cellar/imagemagick/6.7.7-6...
Error: Could not symlink file: /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/wand-view.h
Target /usr/local/include/ImageMagick/wand/wand-view.h already exists. You may need to delete it.
To force the link and delete this file, do:
brew link -f formula_name
To list all files that would be deleted:
brew link -n formula_name
How to link??? what to do?? Can't find answers anywhere!
As suggested in the brew link output, try
brew link -f imagemagick
This should clean up old links in /usr/local/include/ImageMagick/, and then link the files required to complete the installation.
If this doesn't work check that your user has permission to write to /usr/local/include/ImageMagick/*.
After hours and hours of trying the only thing that worked for me was:
sudo brew link --overwrite imagemagick
(Also requires /usr/local/bin/brew to be chowned to root)
Homebrew does not support the overwrite sudo command anymore.
sudo brew link --overwrite imagemagick
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.