1

My neofetch on MacOS Ventura 13.1 shows the wrong disk size, as compared to Settings -> Storage:

neofetch: Disk (/dev/disk1s1s1): 12G / 113G (45%)

Storage GUI: enter image description here

It seems that neofetch is using df -h, but diskutil list shows the proper size.

How do I configure neofetch to use diskutil list instead of df -h?

Thank you.

1
  • 2
    Note that on a filesystem like APFS which has sparse files, transparent compression, deduplication, snapshots, dynamic volume management, etc., there is no single "proper size". It all depends on how you define "proper size" and what your goal is, i.e. why you need this information and what decisions you are planning to make based on that information. May 23, 2023 at 11:34

2 Answers 2

0

As far as I can tell, this is not something that neofetch supports. If you wanted to add it, you'd have to implement a macOS-specific version of the get_disks function that calls diskutil list and parses its output.

Hint: diskutil list -plist | plutil -convert json - -o - will give you a JSON structure that you can parse with jello or jq or a similar utility. Should be somewhat easier than parsing diskutil's default output format.

Good luck!

0

You could use 'dfc' instead 'df', which for me displays correct values under MacOS Ventura.

Here's my df for '/', which indeed is wrong:

df -nh /
Filesystem       Size   Used  Avail Capacity iused     ifree %iused  Mounted on
/dev/disk1s5s1  466Gi  8.7Gi   15Gi    38%  356810 153270600    0%   /

And that's my dfc output looking much more accurate already:

dfc -p /
FILESYSTEM               (=) USED      FREE (-)  %USED AVAILABLE  TOTAL MOUNTED ON
/dev/disk1s5s1           [====================]  96.9%     14.6G 465.6G /

If you call dfc with JSON format, it yields pretty usable output:

dfc -p / -e json | jq '.filesystems[] | select(.mount_point=="/")'
{
  "filesystem": "/dev/disk1s5s1",
  "usage": "96.859399%",
  "available": "14.6G",
  "total": "465.6G",
  "mount_point": "/"
}

You can install 'dfc' with Homebrew:

brew install dfc

In my neofetch I use this command:

  dfc -p / -e json |
    jq -r '
      .filesystems[] |
      select(.mount_point=="/") |
      [.filesystem,
      (.usage|split("%")|.[0]|tonumber|ceil|tostring)+"%", .total, .mount_point] |
      @tsv'

Since it is a little bit too complicated for me to add directly to neofetch's config, I created a small script out of that command and added the script to my neofetch config like so:

prin "${cl4} ├─ ${cl0} $(diskinfo)"

This gives me finally:

Screenshot

You must log in to answer this question.

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