Created
April 9, 2014 05:27
-
-
Save axtl/10228610 to your computer and use it in GitHub Desktop.
homebrew reverse dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import subprocess | |
import sys | |
if len(sys.argv) < 2: | |
raise SystemExit('need a brew to check reverse deps for') | |
check_brew = sys.argv[1] | |
brews = subprocess.check_output(['brew', 'list', '-1']).split() | |
if check_brew not in brews: | |
raise SystemExit('brew not actually installed, moving on') | |
# skip the brew itself | |
brews.remove(check_brew) | |
for brew in brews: | |
try: | |
deps = subprocess.check_output(['brew', 'deps', brew]).split() | |
except subprocess.CalledProcessError: | |
# possible issue calling brew deps due to 'fake formulas' | |
continue | |
if check_brew in deps: | |
print('[*] {}'.format(brew)) |
I concur, @lepistone, that command works fine.
I found the answer in 2021 for these who read this in 2027.. brew leaves
you may have to run it a few times to get rid of everything, but it works!
brew uses --installed
still works in 2020. (You can use it with --recursive
as necessary). Thanks @lepistone! :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about
brew uses --installed
?