diskutil - macOS


diskutil is a command-line utility on macOS used for managing disk drives and volumes. Its capabilities include partitioning disks, formatting volumes, checking disk integrity, and managing RAID sets. This powerful tool is crucial for both system administrators and power users for optimizing storage performance and maintaining disk health.


The general syntax for diskutil is:

diskutil [options] <verb> [verb-specific-options]


  • [options] are the global options applicable to all commands.
  • <verb> specifies the operation to be performed (e.g., list, info, eraseDisk).
  • [verb-specific-options] are the arguments and flags for the specific operation.


  • -h, --help: Displays help message and exits.
  • -v, --verbose: Provides detailed output, useful for debugging purposes.

Common Verbs

  • list: Lists all disks and their partitions.
  • info [disk]: Show detailed information about a specific disk.
  • eraseDisk format name disk: Erases an entire disk, setting it to the given file system format with the specified name.


  1. Listing Disk Information

    diskutil list

    This command will list all the disks and partitions on the system.

  2. Viewing Detailed Disk Information

    diskutil info /dev/disk2

    Replace /dev/disk2 with the identifier for your disk to see detailed information.

  3. Formatting a Disk

    diskutil eraseDisk JHFS+ NewVolume disk2

    This erases disk2, formats it as JHFS+ (Mac OS Extended), and names the volume “NewVolume”.

Common Issues

  • Permission Errors: Diskutil operations often require administrator privileges. Use sudo to run your commands to avoid permission-related errors.
  • Device Busy: Ensure that no applications are using the disk before attempting to modify partition tables or format the disk.


diskutil can be combined with other command-line utilities for scripting and automation. For example:

# Backup disk information before making changes
diskutil list > disk_backup.txt

This command saves the current disk configuration to a file, which can be helpful for recovery in case of errors during disk modification.

  • hdiutil: Used for manipulating disk images.
  • fsck: File system consistency check and interactive repair tool.

For further reading and more detailed information, refer to the man page for diskutil:

man diskutil

This manual provides an extensive overview of all available commands and options within diskutil, suitable for both beginners and advanced users.