brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: diskutil info prints everything macOS knows about one disk or volume

macOS
~/tips/tip-macos-diskutil-info

diskutil info /

Shows the file system, identifier and space of any disk or volume on your Mac.

Finder’s Get Info window tells you how big a drive is and not a lot more. When I want the real details of a volume, such as its file system or the disk identifier macOS gave it, I skip the GUI and ask diskutil instead.

diskutil info takes a device identifier (like disk4 or disk4s1) or a mount point and prints a long list of details about that disk or volume. For your startup volume the mount point is simply a slash:

diskutil info /

For a USB stick you just plugged in, point it at the folder it mounted under:

diskutil info /Volumes/USBSTICK

That tells you whether the stick is ExFAT or APFS before you start copying, and it shows the device identifier you’ll need for other verbs such as diskutil eject. I find it the quickest way to answer “what exactly is this drive?” without clicking through Disk Utility.

Two options are worth knowing. diskutil info -all runs through every disk and partition in one go, and -plist gives you a property list instead of the human-readable text, which is what you want in a script. The GUI has the same information: in Disk Utility, choose View > Show All Devices, select an item and click the Info button.

The caveat is about those identifiers. The man page warns that numbers like disk4 can change after an eject, a reattach or a reboot, so a script shouldn’t hardcode them. Use the volume’s UUID from the same output if a script has to find the same disk tomorrow. And when the free space looks bigger than you expected, remember that Apple counts purgeable space as available: files macOS can remove by itself when it needs the room.

Further reading: diskutil man page (SS64 mirror of Apple's man page), Get detailed information about a disk in Disk Utility

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link