Skip to content

Instantly share code, notes, and snippets.

@scottw
Created January 26, 2018 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottw/edebd8ebe06c5e6e7e0db9f7c8509bea to your computer and use it in GitHub Desktop.
Save scottw/edebd8ebe06c5e6e7e0db9f7c8509bea to your computer and use it in GitHub Desktop.
Script to see what casks depend on other casks (the inverse of 'brew deps')
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
my %deps = map { $_ => [] } map { chomp; $_ } `brew list`;
for my $cask (sort keys %deps) {
print STDERR "\r\e[2KInspecting cask: '$cask'";
my @deps = `brew deps $cask`;
chomp @deps;
push @{$deps{$_}}, $cask for @deps;
}
print STDERR "\r\e[2K";
say "\e[1;34m$_:\e[0m " . join ', ' => @{$deps{$_}} for sort keys %deps;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment