Here’s how I restored my phone to stock rom using macOS:
First of all: download and install Homebrew and then install Python (this is required for motoflash2sh to work).
Download motoflash2sh from here (it’s a Python program that is able to convert flashfile.xml to flashfile.sh)
Download phone’s firmware from the internet (I downloaded mine from some chinese website I found on XDA). It’s a zip file that has to be unpacked inside adb’s platform-tools directory. I had to edit and comment out with # the parts for md5sum checking as I was in a hurry to get my phone fixed ASAP.
You must have adb and fastboot installed on your Mac. It’s available here.
Get your phone on fastboot mode (with the phone turned off press and hold POWER and VOLUME DOWN buttons until it starts and then you may connect the USB cable.
To make sure your phone is being recognized by fastboot, open up a terminal and navigate to where adb and fastboot platform-tools are and then type: ./fastboot devices (you may as welll try running the command without the ‘./’). Firmware files should be placed in the directory along with adb and fastboot binaries.
P.S.: this process may work with another models.
I hope it will help someone without a Windows PC nearby. Good luck! Cheers!
UPDATE (MAR 15th 2023):
#1: Install md5sha1sum from Homebrew to avoid the md5sum error mentioned earlier. It’s also possible to have motoflash2sh.sh skip md5sum checking altogether with the command motoflash2sh -n flashfile.xml.
#2: When fastboot.sh is done reflashing it’s wise to relock the bootloader BEFORE LEAVING FASTBOOT (fastboot flashing lock) in case you ever want to use Google Pay contactless payments (I learned that the hard way the first time I reflashed and forgot to relock the bootloader right away and ended up getting back to fastboot everytime the phone restarted).