Quick: dd with progress indication on macOS

Quick: dd with progress indication on macOS

While newer versions of dd on Ubuntu or the like come with a new option called status=progress, the one included with macOS sadly does not.

A nice way I found to get progress indication whilst still being able to benefit from the huge speed increase in using /dev/rdiskX is to install a tool called pv, also known as Pipe Viewer.

brew install pv

Now, split up your dd command into two, and pipe everything through pv. If you know the size of the input drive, provide that to pv as-well as it will further improve the output. Take this example, where my input drive is 64GB:

sudo dd if=/dev/rdiskX bs=1m | pv -s 64G | sudo dd of=/dev/rdiskY bs=1m

This will result in a familiar looking progress indicator, as-well as an ETA and transfer speeds.

This method also works very well when zeroing out drives, something I had to do quite a lot recently as I was preparing to sell off some older drives. Using the following command for a 500GB drive, for example, worked great:

sudo dd if=/dev/zero | pv -s 500G | sudo dd of=/dev/rdiskY bs=1m

It's quite useful to finally have some insight into how far along a task like this is, as it's usually quite a time consuming one.

Alternative method: gdd (works, but slower)

Another way to achieve something similar would be to use brew to install coreutils, which will come with a newer version of dd that supports the status option.

brew install coreutils

All tools installed with this package are named with g prefixed to them, so you can run gdd to use this packages' version of dd.

gdd if=/dev/diskX of=/dev/diskY bs=1m status=progress

Sadly, this version of dd lacks support for macOS' "raw" disk support (/dev/rdiskX), which means it will be significantly slower to copy a disk over, but there might be certain scenarios where this method is preferred.

I hope this helps!

Thanks.