Write an img file to an SD card in macOS

Open a terminal window

Get a list of attached disks

diskutil list

Identify the SD card disk ID (not the partition).

You will be using that wherever I use “diskNN

Unmount the SD card

diskutil unmountDisk /dev/diskNN

Write the image to the SD card

sudo dd bs=1m if=/path/to/image.img of=/dev/diskNN

You will be asked for your password and then it will appear to do nothing for quite a while, eventually it will finish and report the number of blocks written.