Any tips on creating a backup image of the SD card on OSX?

This isn't an OctoPrint-specific question, but I bet some users here have run into this, and might have some suggestions. I'm doing some development related to OctoPrint. I have an installation of OctoPi running OctoPrint, and some additional configurations set. I'd like to make a backup/clone of the SD card so that, if the system becomes unstable, or I'd just like a fresh copy to test against, I can re-apply the backup.

I'm running OSX and I've tried creating a backup image of my OctoPi SD card using balenaEtcher, Carbon Copy Cloner, and Apple's Disk Util, but nothing seems to work. For example, when I use Disk Util to create an image of the SD card, the image is created, but when I try to restore onto another SD card (the same brand and same size even) I get "Error 22 - Invalid Argument".

I've tried creating a backup image and then restoring several times, with several different applications, but nothing is working end-to-end so far, and I was wondering 1) how are the restore/install images for OctoPi made? and 2) if anyone has a recommended way (and preferably with instructions) for creating a backup image.



I have a USB SD (and microSD) card reader so I just plug it into my RPi and use rpi-clone.

The advantage of having this second microSD card available on the RPi is I can mount the partitions and copy individual files or directories from one OS instance to another.

Thanks @b-morgan, that worked great! I wasn't even aware of rpi-clone.