1

How do I know if I can or should clean up anything? I have a ton of installed apps, and a brew update takes forever.

I'd like to at least find which apps I no longer use.

I did brew autoremove, one question here, and it found and removed a couple files, but no noticeable difference in brew update.

I can brew list, but so many of them are libraries, and there are so many of them, that I don't really want to do brew info app on each of them. Surely there's a way to tell the difference between apps that I installed vs libraries?

Polo
  • 41

1 Answers1

1

A Perl script to get Access times of the target of the links placed in /usr/local/bin. Then it shows the oldest-accessed files last.

But I don't know if this is the best answer, or if there's something that can be done in homebrew. I don't even know if this is necessary - is speeding up the upgrade process possible?

#!/usr/bin/perl
# Looking for old homebrew apps to get rid of

use strict; use warnings; use File::Spec; use POSIX qw(strftime);

my $dir = '/usr/local/bin';

my @sorted_by_oldest_used = sort { $b->[2] <=> $a->[2] } map { my $t = readlink; $t = "$dir/$t" if not File::Spec->file_name_is_absolute($t); $t =~ /Cellar|Cask/ ? [ $_, $t, -A $t ] : () } grep { -l } glob "$dir/*";

foreach my $res_ar (reverse @sorted_by_oldest_used) { my $date = strftime("%Y_%m_%d_%H:%M:%S", localtime(time - $res_ar->[2] * 24 * 60 * 60)); printf "%s\t%s\n", $date, $res_ar->[0]; }

Code credit: Stackoverflow question I asked, with a better response than the script I came up with.

Polo
  • 41