Skip to content
Home » hdiutil vs diskutil on macOS: What Each Tool Actually Owns

hdiutil vs diskutil on macOS: What Each Tool Actually Owns

The usual one-line answer — hdiutil is for disk image files, diskutil is for physical disks — was clean and correct for years. On macOS 26.5.2 (build 25F84) it’s no longer the whole story, because diskutil has grown a diskutil image subcommand that attaches, creates, and inspects disk images on its own. The two tools now overlap on a real part of what they do, so the useful question isn’t “which is which” but “what does each still own, and where do they now do the same job.”

Both ship with macOS — hdiutil in /usr/bin, diskutil in /usr/sbin — so there’s nothing to install, and neither exists on Linux or Windows, so command not found for either one almost always means it’s being run somewhere that isn’t a Mac. Everything below was checked on 26.5.2. Where a device or volume name shows up in output it comes from a throwaway test image, not this machine’s own disks.

What only diskutil can do: real disks

diskutil is the only one of the two that touches physical storage, and most of its verbs are about disks and the volumes on them: list, info, eraseDisk, eraseVolume, partitionDisk, addPartition, mergePartitions, repairDisk, apfs (its own family of container and volume verbs), coreStorage, appleRAID, secureErase. None of these have any equivalent in hdiutil. Erasing a USB stick, repartitioning a drive, adding or resizing an APFS volume, reading the partition map of the disk you booted from — that’s all diskutil, and hdiutil has no verb for any of it.

Running hdiutil with no arguments confirms the gap: nothing in its verb list partitions or erases a physical disk. hdiutil erasekeys sounds close but only discards an encrypted image’s keys — it doesn’t erase a drive.

What only hdiutil can do: transform an image

Going the other way, hdiutil owns the verbs that transform a disk image rather than just attach or create it. convert changes an image’s format — it’s the command that turns a DMG into an ISO, and the one with the .cdr surprise covered in the hdiutil write-up. makehybrid builds an ISO 9660 / Joliet image from a folder, burn writes an image to optical media, segment splits one into pieces, and checksum and verify work with image checksums directly. None of these appear under diskutil image, whose subcommands stop at attach, create, info, resize, and chpass.

Where they overlap now: diskutil learned disk images

This is the part most hdiutil-versus-diskutil comparisons predate. diskutil image lists five subcommands — attach, create, info, resize, chpass — and each one mirrors a job hdiutil has always done. Attaching the same DMG through diskutil produces the same mounted volume, with output that’s arguably easier to read than hdiutil’s, since it labels the container and volume rather than printing raw partition types:

$ diskutil image attach app.dmg
/dev/disk19    GUID_partition_scheme
/dev/disk19s1  Apple_APFS
/dev/disk20    Apple_APFS_Container
/dev/disk20s1  Apple_APFS_Volume    /Volumes/VS_TEST

(VS_TEST is the volume name of a throwaway test image.) Its info subcommand is more structured than hdiutil imageinfo too, breaking the same facts into labelled groups:

$ diskutil image info app.dmg
Image Format: UDZO
Format Description: UDIF read-only compressed image (zlib)
    Size Info:
        Max Size Bytes: 10519552
    Compression Info:
        Compression Type: zlib
    Encryption Info:
        Is Encrypted: 0

The overlap runs the other direction at the moment of ejecting. Once an image is attached — whichever tool attached it — its volume is just a device, so either tool can unmount it. An image attached with hdiutil attach ejects cleanly with a diskutil command:

$ diskutil eject /Volumes/VS_TEST
Disk /Volumes/VS_TEST ejected

That’s why the two commands feel interchangeable for mounting and ejecting in practice — after attach there’s no “hdiutil volume” versus “diskutil volume,” just a mounted volume either one can act on.

So which do you reach for?

The jobThe tool
Erase or partition a physical disk, manage APFS containers, repair a volumediskutil only
Convert a DMG to an ISO, makehybrid, burn to disc, segment, checksumhdiutil only
Attach, create, inspect, or resize a disk imageeither — hdiutil or diskutil image
Eject a volume that’s already attachedeither

For the overlapping jobs the tie-breakers are practical. hdiutil has been present and stable on every macOS release for a very long time, so scripts and instructions meant to run anywhere still reach for it. diskutil image is the newer arrival, with cleaner, labelled output that reads better for a one-off at the terminal. And for anything only one of them can do — a physical disk, or reshaping an image’s format — the choice makes itself.

The short version: if your target is a file, either tool can now attach or create it, but only hdiutil can reshape it; if your target is a disk, it’s diskutil, and always has been. The old split still holds at the edges — it’s the middle, attaching and creating disk images, that both tools now share.

Leave a Reply

Your email address will not be published. Required fields are marked *