Writing SD Cards: Mac OS X

Apple provides a copy of dd with recent releases of OS X (at least since 10.7, probably earlier).

Finding the SD card descriptor:

  1. Insert the SD card
  2. In a terminal run diskutil list. Look for the SD card in the list of disks. On a MacBook with a singe hard drive, the output is:
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.1 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            499.2 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *2.0 GB     disk1
       1:                 DOS_FAT_32 WARP SD                 32.0 MB    disk1s1
  3. In this example, the SD card device descriptor is /dev/disk1. The actual descriptor will differ on other machines with different disk configurations, but should take the form /dev/diskX.

Copying the .bin file:

  1. Unmount (not eject) the drive using this command (replacing X with your actual SD descriptor):
    diskutil unmountDisk /dev/diskX
  2. Run this command, replacing the last three arguments with the correct values:
    dd bs=512 seek=<N> if=<yourFile.bin> of=</dev/diskX>
    1. <N>: depends on the target slot number; use (131072 + slotNum*32768). More details here.
    2. <yourFile.bin>: the binary FPGA configuration file
    3. </dev/diskX>: device descriptor for the SD card
  3. If successful, dd should report the following (the time/throughput values will differ):
    18032+1 records in
    18032+1 records out
    9232444 bytes transferred in 8.503631 secs (1085706 bytes/sec)
  4. Repeat for additional .bin config files in additional slots if needed.
  5. Eject the SD card in the Finder (if it's mounted).

Using a shell script to copy a .bin file to the SD card:
The following script automatically looks for the file descriptor of the SD card and copies the .bin file to the chosen slot. To execute the script:

  1. copy the script to a text file
  2. save it under the name
  3. make it executable (chmod +x
  4. run it as root: sudo ./
    # Author: Matthias Schulz <>
    # The author is not responsible for the consequences of use of this script
    # Check if at least two arguments are passed
    if [ $# -lt 2 ]
            echo "Usage : ./ filename slot [description]"
    if [ $# -eq 3 ]
    		find "/Volumes/WARP SD" -name "`printf \"Slot %s - *\" \"$2\"`" -delete
    		FILE="/Volumes/WARP SD/`printf \"Slot %s - %s\" \"$2\" \"$3\"`"
    		echo "" > $FILE
    DISK=/dev/`diskutil list | grep "WARP SD" | cut -c 69-73`
    diskutil unmountDisk $DISK
    case "$2" in
    0)  dd bs=512 seek=131072 if=$1 of=$DISK
    1)  dd bs=512 seek=163840 if=$1 of=$DISK
    2)  dd bs=512 seek=196608 if=$1 of=$DISK
    3) dd bs=512 seek=229376 if=$1 of=$DISK
    4) dd bs=512 seek=262144 if=$1 of=$DISK
    5) dd bs=512 seek=294912 if=$1 of=$DISK
    6) dd bs=512 seek=327680 if=$1 of=$DISK
    7) dd bs=512 seek=360448 if=$1 of=$DISK
    *) echo "Error: use a slot number between 0 and 7"
    diskutil unmountDisk $DISK
Last modified 8 years ago Last modified on Apr 21, 2014, 8:37:37 AM