How to flash original android completely on Mac?

Download TWRP (Bootloader)

TWRP allow you install other unofficial systems to you phone. Choose the right twrp according to your phone.

Download ROM for Android 10 (Like Linux ISO)

There are different types of Android ROM, and I choose Pixelexperience for Xiaomi_Redmi_Note_5/Plus because I love google product and I’m using Redmi 5 Plus.

Install ADB and Flashboot for mac use one command (Some Tools)

brew cask install android-platform-tools

Make sure the following cmd worked:

adb --version
fastboot --version

Open Debug Mode on your phone, and use USB cable connect your phone to your Mac. In your Mac Terminal:

adb devices

Unlock XiaoMi (So that you can install unofficial systems)

Download XiaoMiToolV2 to unlock RedMi 5 Plus according its guide.

Delete something (Something like format, partition)

adb reboot bootloader

Wait the phone to enter fastboot mode.

And then,

fastboot -w

This is important because if you haven’t do this. You will meet some problems like Error: Can't mount /data/ .

Burn Recovery TWRP to your phone. (Install bootloader)

fastboot flash recovery twrp.img
fastboot boot twrp.img

And wait to the phone to enter fastboot mode.

Send your ROM to your Phone using ADB

And In your Mac terminal, cd to the path of your ROM, run

adb push PixelExperience_vince-10.0-20200409-1002-OFFICIAL.zip  /sdcard/

and wait the transferring complete.

Install the new system.

Then on your phone, choose install, and select your ROM.

And wait, until it let you reboot your phone.

Have fun.