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.

Thanks,

Jeff

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.

I like the simple answers left here but they didn't help me as a noom, I have no idea as to how to use rpi clone. BUT I find a wonderful post that looks complex, but is the easiest and best way I have found to make a rliable and easy to verfy backup of my Rbpi. It also includes instructions on how to automatically make backups periodically.

Hi!
Win32 disk imager working but tricky the "write sd to .img file" mode aka "read SD".

device: select first SD partition (fat)

picture:

enter the path and file name manually in the "image" textbox and press the "read" button.
for example: D:\download2\3d print\octoprint\image.img

Need exit the "google drive" and other not valid device and eject the g: drive if won't started the win32 disk imager.