28

I need to free up space on my Mac and know there are a ton of hidden files that are eating up space (Logic for example downloads a lot of instruments... somewhere).

Is there any way I can create an interactive (or non-interactive) treemap of my hard drive?

Here is an example of a treemap from Wikipedia

Graphical representation of a treemap

5
  • @l'L'l Not quite a duplicate — most of those solutions included the accepted answer don't produce Treemaps.
    – grg
    Jan 21 '14 at 17:45
  • ^ see the second link.
    – l'L'l
    Jan 21 '14 at 17:46
  • However, the answers to both questions contain all the recent tree map type utilities that are in common use. What about your situation makes you think "tons of hidden files" are in play? Finder will show you folder sizes quite easily and you can navigate to locate things without needing any extra software.
    – bmike
    Jan 21 '14 at 18:46
  • To answer bmike, I use Xamarin, and each time I run debut on an app, temp files are created and remain May 29 '20 at 13:23
19

GrandPerspective can create a Treemap:

GrandPerspective screenshot

23

try

du -sh *  | grep -E "\dG"

to get all files and folders of size 1G and above. (Output will only show once du is done)

3
  • not include folder Feb 21 '19 at 13:26
  • this is awesome - returns files and folders above 1GB in the directory where its run. So we can run it at the top most level and traverse from there
    – Anupam
    Apr 15 '21 at 4:31
  • du: illegal option -- O
    – Anthony
    Jan 6 at 23:12
15

You can use spotlight as well:

mdfind 'kMDItemFSSize > 2000000000'

Add or remove zeroes to get fewer or more files under the size limit, respectively.

2
2

I've had success using:

Disk Inventory X (free download)

enter image description here

It's like WinDirStat was on Windows.

2
  • It says that I can't install it because this app is coming from a non identified user: Impossible d'ouvrir "Disk Inventory X" car cette app provient d'un développeur non identifié Oct 8 '20 at 3:40
  • 1
    @DimitriKopriwa That has happened to me on Mac before. Hold the control key: kb.wisc.edu/helpdesk/page.php?id=25443#manual
    – Ryan
    Oct 8 '20 at 14:05
1

OmniDiskSweeper

shows you the files on your drive, largest to smallest

great free tool

0

Inspired by this answer, I came up with the following to find directories of 1 GB or greater:

du -ht 1G / 2>/dev/null | sort -nr

Breakdown

du -ht 1G / 2>/dev/null | sort -nr
du -h # print sizes in human readable format (e.g., 1K 234M 2G)
     t 1G # exclude entries smaller than 1G
          / # system root directory
            2>/dev/null # redirect stderr (error) output to /dev/null, effectively ignoring it
                        | sort # pipe the output into sort
                               -n # compare according to string numerical value
                                 r # reverse the sort, effectively putting the largest files and directories first

Note that du's -t 1G argument can take other size parameters too (from man du):

-t exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative. The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on.

Bear in mind that sort just sorts on the numerical value, not the unit size. You might want to use du's -B option too, to round up to the nearest G, for example.

Another useful du argument might be -a to list files, not just directories.


I use the following binaries on my system:

$ du --version

du (GNU coreutils) 9.0
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, Paul Eggert,
and Jim Meyering.

$ sort --version

sort (GNU coreutils) 9.0
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.
-1

Clean Up Old and Large Files with CleanMyMac 3

The Large & Old Files module in CleanMyMac 3 makes finding space-hoggers on your Mac simple. Just run a scan to see all the files that are taking up the most space — and then clean them up.

enter image description here

How does the Large & Old Files module help me? Everyone has (at one time or another) thrown files into random folders. It’s easy for these files to take up gigabytes of space without even realizing it! CleanMyMac 3’s Large & Old Files scans your entire Mac and brings all these files to the surface. Plus, it lets you see what’s what, based on a file’s size, date last opened, and type.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .