Skip to content

Instantly share code, notes, and snippets.

@idserda
Last active August 29, 2015 14:08
Show Gist options
  • Save idserda/b2895df077676e012bbe to your computer and use it in GitHub Desktop.
Save idserda/b2895df077676e012bbe to your computer and use it in GitHub Desktop.
Simple bash script for Mac OS X to write a disk image to removable media (sd card) or another file, with progress information
#!/bin/bash
NUMARGS=2
if [ $# -ne $NUMARGS ]
then
echo "Usage: `basename $0` </dev/diskN> <file.img>"
exit
fi
DEVICE="$1"
IMAGE="$2"
diskutil unmountDisk $DEVICE
dd if=$IMAGE bs=1m | pv -ptre $IMAGE | dd of=$DEVICE bs=1m
diskutil eject $DEVICE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment