dd - macOS


The dd command in macOS is a versatile utility primarily used for low-level copying and conversion of raw data. It is highly useful for creating exact block-level copies of volumes, disks, and files, and for performing data backup and recovery, disk cloning, and data wiping tasks.


The basic syntax of the dd command is as follows:

dd [options]

The command works by reading from a specified input, processing it, and then writing it to an output. Operation parameters such as input file and output file are set using operand=value pairs like if=file for input and of=file for output.


Here are some commonly used options for dd:

  • if=<file>: Input file (defaults to standard input).
  • of=<file>: Output file (defaults to standard output).
  • bs=<bytes>: Block size – defines sizes of blocks for both reading and writing.
  • count=<blocks>: Only copy this amount of blocks.
  • skip=<blocks>: Skip this number of blocks (from the start of the input file).
  • seek=<blocks>: Skip this number of blocks (on the output file).
  • conv=<options>: Conversion options (e.g., noerror, sync, notrunc).

Each option affects the behavior of the command during the process:

  • bs=4k reads and writes in blocks of 4KB.
  • count=1 stops after writing one block of data.
  • conv=noerror continues processing after a read error.


  1. Create a disk backup:
    dd if=/dev/disk2 of=/path/to/backup.dmg
  2. Copy part of a file:
    dd if=sourcefile.txt of=destinationfile.txt bs=1k count=10
  3. Create a bootable USB drive from a disk image:
    dd if=path/to/image.iso of=/dev/disk2 bs=4m && sync

Common Issues

  • Permission Errors: Ensure you have the necessary permissions to read from the input or write to the output. Using sudo often solves this.
  • Data Corruption: Always verify data integrity after copying, especially when creating bootable media or backups.
  • Slow Performance: Adjust the block size (bs) for better performance. The optimal size depends largely on the specific hardware.


dd can be paired with other macOS tools to automate and enhance file handling tasks:

gzip -c /dev/disk2 | dd of=compressed_disk_backup.dmg

This command chains gzip for compression with dd for creating a compressed disk image.

  • cp: Common command for copying files and directories.
  • rsync: Useful for backing up and synchronizing files.
  • diskutil: macOS disk management tool, often used together with dd for handling disk-related tasks.

Additional resources can be found in macOS’s man pages (man dd) or online at the GNU core utilities website.