Plug the SD in your Mac.
In the Terminal, as root, use diskutil to identify your SD.
Generally it's the last in the list, if you've just plugged in.
shellsession
root:~ # diskutil list
You will see something like this:
In my case, the SD is /dev/disk4. For this reason, I run the following to unmount the whole disk.
shellsession
root:~ # diskutil umountDisk /dev/disk4
Unmount of all volumes on disk4 was successful
Once done, you can create the backup using dd utility, but make sure to change the device from /dev/diskX to /dev/rdiskX, adding the "r".
shellsession
root:~ # dd if=/dev/rdisk4 of=/path/to/mypibackup.img bs=1m
To restore, of course... invert if (input file) with of (output file)... :-)
shellsession
root:~ # dd if=/path/to/mypibackup.img of=/dev/rdisk4 bs=1m