The Custom Droid

Android Tutorials, Tips and Tricks

Install TWRP and Root OnePlus 5/5T on Android Pie (OxygenOS 9.0+)

How to Install TWRP and Root OnePlus 5/5T on Android Pie

If you have updated to Android Pie-based OxygenOS 9.0, then follow this tutorial on how to install TWRP recovery and root OnePlus 5/5T on Android Pie.


OnePlus devices have gained a lot of recognition this year due to its powerful hardware specs and excellent software support. Recently, the manufacturer released Android Pie update for OnePlus 5 and OnePlus 5T via OxygenOS 9.0. There’s no doubt that the devices while offering a near-AOSP experience can also be customized easily, similar to the Google Pixel lineup.

If you have updated your 2017 OnePlus flagships to OxygenOS 9.0 or above and want to root the device on Android Pie, then we have got you covered. Rooting the latest Android version requires you to use a modified version of the TWRP, as well as the latest Magisk root package.

Guide to Install TWRP Recovery and Root OnePlus 5/5T on Android Pie

Just like the previous Android version, Android Pie also brings some complications to the customization scene for the OnePlus 5 and 5T. The official TWRP doesn’t play well with Pie, lacks decryption and Project Treble support and also wouldn’t allow you to flash full OxygenOS ROM packages.

To overcome this problem, you will need to install unofficial TWRP recovery on your OnePlus 5 and OnePlus 5T that is built on the Android Pie and latest TWRP source code. You can either use blu_spark TWRP by famous kernel developer eng.stk or and Codeworkx TWRP by Recognized Developer codeworkx, respectively. Both of these unofficial TWRP recovery builds are based on Android Pie source code.

Once you have flashed either one of the stated TWRP recovery builds, you can easily root OnePlus 5 and OnePlus 5T on Android Pie using the latest version of Magisk.


  • Take a complete backup of all your apps and data stored on the phone, including the internal storage. We also have a detailed guide on how to back up that you might want to use.
  • You must have an unlocked bootloader in order to install TWRP and root OnePlus 5/5T on Android Pie. If you still haven’t unlocked the bootloader, then specific guides for both the devices could be found here and here, respectively.
  • Charge your OnePlus 5/5T to a sufficient battery level (About 40-60%) to prevent any sudden shutdowns during the process.
  • Install and set up ADB on your PC. We will be referring to C:\adb in this tutorial, which is the folder on your PC where the ADB/fastboot binaries are extracted.


There are two different TWRP builds (blu_spark and codeworkx) provided below. You can choose either of them.

Install blu_spark/codeworkx TWRP on OnePlus 5/5T

The first step to root OnePlus 5/5T on Android Pie is to flash the compatible TWRP recovery on the device.

  1. Boot your OnePlus 5/5T into Fastboot mode:
    • Power down the device completely;
    • Press and hold the Volume Up and Power button simultaneously to enter Bootloader Mode.
      Boot OnePlus 5 into Bootloader Mode
  2. Connect your device to the PC via the USB cable
  3. Download the blu_spark or codeworkx TWRP recovery image on the PC
  4. Copy the downloaded file to C:\adb, where all the ADB and Fastboot files are present.
  5. Hold the SHIFT key on the keyboard and right-click on any empty space inside this folder.
  6. Select ‘Open PowerShell window here’ option from the menu.
    Root OnePlus 5/5T on Android Pie - Open PowerShell window here
  7. Execute the following command to install TWRP recovery on OnePlus 5/5T running OxygenOS 9.0:
    • blu_spark on OnePlus 5/5T:
      fastboot flash recovery twrp-3.3.1-x_blu_spark_v9.101_treble-op5_op5t.img
    • codeworkx on OnePlus 5:
      fastboot flash recovery twrp-3.3.0-0-20190427-codeworkx-cheeseburger.img
    • codeworkx on OnePlus 5T:
      fastboot flash recovery twrp-3.3.0-0-20190427-codeworkx-dumpling.img
  8. Once installed, it is important to boot your OnePlus 5/5T directly into TWRP. If you try to boot the phone into the OS, it will enter a bootloop due to dm-verity.
  9. To do so, enter the following command in the PowerShell window while holding the Volume Down button of your device:
    fastboot reboot

Now that you have successfully flashed and booted into TWRP, follow the steps in the next section to root OnePlus 5/5T on Android Pie.

Root OnePlus 5/5T on Android Pie using Magisk

  1. Download latest Magisk 19.3 installer zip
  2. In TWRP, slide the ‘Swipe to Allow Modifications’ button
    TWRP Recovery on OnePlus 5/5T - Swipe to Allow Modifications
  3. Go to ‘Mount’ and tap on the ‘Enable MTP’ button
  4. Connect your device to the PC and transfer the Magisk zip to the internal storage of the device
  5. Disconnect the phone from the PC
  6. Go back to the main TWRP menu and tap on the ‘Install’ button
  7. Navigate to the location where you transferred the Magisk 19.3 installer file ( and select it.
    Root OnePlus 5/5T on Android Pie - Flash Magisk v19.3 Installer ZIP
  8. Swipe the button on the screen to flash Magisk and root OnePlus 5/5T on Android Pie
  9. Once the flashing process is complete, press the ‘Reboot System’ button.

Your OnePlus 5/5T should boot and would be running rooted OxygenOS 9.0 based on Android Pie. You can go ahead and use root-enabled apps and mods like ViPER4Android. If you have rooted the device using Magisk, you can install from a long list of modules to enjoy additional features on your OnePlus device.

Additional guide: How to Decrypt OnePlus 5/5T and Disable Forced-Encryption

So we have just guided you on how to root OnePlus 5 and OnePlus 5T on Android Pie. If you have any questions regarding the process, leave a comment below.

TWRP Source: blu_spark/codeworkx (1 and 2)

About the Author

Founder and Editor-in-Chief

Dhananjay has more than 11 years of experience in Android software customization and development, and has spent the past 10 years writing about it. He spends most of his prime time reading, learning and writing about Android and other open-source projects. He is also a community-taught web developer. Apart from that, he loves mountain biking and playing video games on his PlayStation.

Leave a Reply

Comments are moderated, and published only if they are relevant to the topic and add value in a constructive way. If you disagree with something, please be polite and respectful. We suggest you read our comment policy before commenting.