i don't really know any way to do it on a MAC....can mac os run bash scripts? the fastboot package comes with some .sh files you might be able to run...
before doing format, make that backup using miui backup or any other app you like. Then copy backup data to computer and after reset copy that folder back to phone and restore the data using same app
Factory reset with erase emulated sdcard option will erase every thing on your phone including card so be careful. Copy all important things to computer before doing it