A couple of months back, Xiaomi launched its new flagship phone dubbed the Mi 9. The Mi 9 comes with an AMOLED display at 2,340×1,080px resolution and HDR10 complaint display, the elimination of nearly all bezels with just a tiny cutout on top to house the 20 MP selfie camera, a triple rear camera setup (48 MP, f/1.75 primary with PDAF and Laser Autofocus; 12 MP, f/2.2 2x telephoto; 16 MP, f/2.2 ultrawide wide-angle lens), the latest Qualcomm Snapdragon 855 (4×2.84 GHz Kryo 485 Gold & 4×1.7 GHz Kryo 485 Silver), Adreno 640 GPU, 3300 mAh battery with support for 27W fast wired charging and 20W fast wireless charging, up to 8GB RAM, up to 256 GB UFS 2.1 storage, a under the display optical fingerprint reader, and much more.
Installing TWRP Recovery on Xiaomi Mi 9 will help you install custom ROMs, Custom Kernels, and also enabled you to easily root your device. While there are many other ways by which you can root an Android device, using Magisk to root Android is the best way as of now. And for that TWRP is mandatory! Read ahead to know how to install TWRP on the Xiaomi Mi 9 and then how to root it using Magisk.
- Rooting may be a pretty complex task for some. Make sure to take a complete backup of your device before proceeding. Guide: Guide to Backup Android Device Without Root
- Make sure you have enough charge left on your device. A minimum of 60% is recommended.
- Make sure you have the latest ADB and Fastboot tool installed on your Mac/Windows/Linux in addition to the latest Xioami USB drivers.
- Enable USB Debugging and OEM unlock in Developer Options.
- Toggle on Advanced Reboot in the Developer Options. (Optional but recommended)
Rooting your device will require you to unlock your bootloader. In most cases, this will effectively void your device warranty. That said, unlocking bootloader/rooting are complex processes and may not always produce the desired results. Know what you are doing and always have a backup before proceeding. The author or ThemeFoxx cannot be held responsible in case anything unexpected happens to your device. Remember, you are warned.
Steps To Unlock The Bootloader Of Xioami Mi 9
Get The Bootloader Unlock Code From Xiaomi
Xiaomi does not readily ship their phones with an unlocked bootloader nor is the bootloader unlocking procedure in Xiaomi phones as simple as that of the phones from OnePlus or Google Pixel counterparts. Hence, to unlock the bootloader, one needs to visit the Xiaomi website and register for the same.
- Click on the link and then click on “Unlock Now.” You will be greeted by a form which needs to fill up by you.
- Once you submit the form, you will be asked for an OTP verification and once done your application to unlock the bootloader of your Xiaomi phone will be submitted.
Once your application is successfully submitted, you need to wait for some days until you get a message of acceptance which says that you are eligible to unlock the bootloader.
Once you are eligible to unlock the bootloader, follow these steps:
- Power off your device and press the volume up and power button simultaneously to boot your device into fastboot mode.
- Connect your phone with your PC via a USB cable.
- Download and install Mi Unlock Tool on your PC. Once installed, run it and log in using your Mi ID and password.
- Once logged in, click on Next and then click on Unlock to unlock the bootloader.
Once this process completes, your bootloader will be unlocked.
Steps To Install TWRP and Root Your Xioami Mi 9
Download these files before moving onto the step by step guide.
Download and transfer the 1st file to the location where ADB tools are installed on your PC while transferring the 2nd file to a location in the external SD card.
- Connect your phone with your PC via a USB cable.
- Navigate to the folder where you have the adb and fastboot tools installed and open a command prompt window there.
- Once connected, type the following command in the command window and this command should return your device’s serial number. If your device’s serial number does not appear, the connection between your PC and Phone is broken.
- If your phone’s serial number appears, type the following commands to boot your device into fastboot mode:
adb reboot bootloader
- Now, type the following code to flash TWRP recovery in your device:
fastboot flash recovery *****.img
Note: Replace ***** with the name of the TWRP recovery file that you downloaded from the downloads section.
- Once the TWRP recovery is flashed to your device, power off your device and reboot it into the recovery mode by pressing the Volume Up and Power button simultaneously.
- In the TWRP recovery screen, swipe on the required space on your screen to allow modifications.
- On the main screen of TWRP, select Install and then navigate to the location where you have stored the Magisk zip file which you downloaded from the downloads section. Swipe at the bottom part of the screen to flash the zip file.
- When the flashing completes successfully, normally reboot your device.
Once the installation finished, reboot your device and look for an app called Magisk Manager. If it is not installed, download Magisk Manager APK and install it on your device.
Recommended: Best Magisk Modules for Android 
Congratulations! You just successfully unblocked the bootloader, installed TWRP and rooted your Xioami Mi 9 using Magisk.
This is the easiest way to root your Xioami Mi 9. I hope this article works the way it is intended to be. Let us know about your experience trying out the methods mentioned in this article in the comments section down below. In case I missed mentioning anything or if there is some topic which you want me to cover, please let me know in the comments section down below.