OnePlus 5/5T: Unlocking bootloader & Installing TWRP

Guide for unlocking the bootloader and installing TWRP Recovery on OnePlus 5/5T. I will go over this on Linux, but it will surely work on Windows, as well as on macOS.

Requirements & preparation

  • OnePlus 5 phone, duh!
  • running stock/default OxygenOS system (updated to latest version)
  • ..which is based on Android 9 Pie (check Settings > About phone)
  • not rooted

Make sure all of your data on your OnePlus 5 are properly backed up - everything will be erased in this process (you have been warned)!

If you have custom ROMs (other than stock OxygenOS), this guide won’t work for you, sorry.


OnePlus 5: Enabling Developer options

  • Settings > About phone > keep tapping on “Build number” until you get a notification that “You’re a developer”
  • Settings > System > Developer options - enable these:
    • OEM unlocking
    • Advanced reboot
    • USB debugging


Download and save these for later

Transfer this file to your phone (ie. connect your OnePlus phone via USB to your PC, enable File transfer and copy the files over to your Internal storage).

Unlocking bootloader

You can probably skip steps 1-3 by installing android-sdk-platform-tools from Arch’s AUR, though I haven’t tested it myself

  1. Go to Android Studio - Command line tools only and download sdk-tools for your OS
  2. Extract it and navigate to SDK Manager - on Linux: in sdkmanager in tools/bin/ folder)
  3. Install SDK Platform Tools:
$ ./sdkmanager "platform-tools"
  1. Connect your OnePlus 5 via USB cable to your PC
  2. Navigate to newly created platform-tools folder (should be on the same level as tools folder from step 2, ie. go up 2 directories) and check if ADB recognizes your phone:
$ cd ../../platform-tools/
$ ./adb devices

No permissions errror? If you’ll get an error about “no permissions” and not being a member of pludgev group, fix it by sudo usermod -aG plugdev $LOGNAME. Be sure to logout and login back in after that.

Wrong udev rules error? Install android-udev package (Arch) or adb (Ubuntu) - both of these should contain maintained udev rules for Android under Linux. Restart udevd afterwards: $ sudo systemctl restart systemd-udevd.

If all goes right, you should see something like this (instead of “xxxxxxxx” you’ll see a different string ~ your serial number):

$ ./adb devices
List of devices attached
xxxxxxxx    device
  1. Restart your OnePlus 5 phone into Bootloader - long press power button and select Bootloader.
  2. When you’ve booted into the Bootloader (“FastBoot mode”), go back to your terminal and enter:
$ ./fastboot devices
xxxxxxxx    fastboot

As before, if all goes right, you will see your serial number (here “xxxxxxxx”) and “fastboot”. If you don’t see this, make sure you have the udev rules correctly set-up.

  1. Unlock bootloader (finally!) - in Terminal:
$ ./fastboot oem unlock

Your OnePlus 5 will switch screen to a friendly disclaimer - use your volume keys to navigate and power button to confirm that you indeed want to unlock the bootloader. After all, you’ve come all this way, right?

Now the device will flash and clean, then restarts itself. At this point, your OnePlus 5 will act as a brand new phone, greeting you with the configuration wizard.

Once you’re done with initial setup, head over again to Settings and repeat steps necessary to enable developer mode, Advanced boot and USB debugging (see Requirements & preparation > Phone at the beginning of this guide).

Installing TWRP Recovery on OnePlus 5

  1. Download TWRP for Oneplus 5 - be sure to choose the one for Android 9.x (requires Pie firmware) - there are 2 download links available
  2. Reboot to Bootloader (~ FastBoot) again by holding down power button - keep your phone connected to PC
  3. When rebooted into FastBoot, switch over to your Terminal and run fastboot again (still in the platform-tools folder as before):
$ ./fastboot devices
xxxxxxxx    fastboot
  1. Copy downloaded TWRP file into the same folder as fastboot on your PC (ie. into platform-tools folder)
  2. Flash TWRP to your phone via Terminal (if you’ve downloaded newer version of TWRP, make sure to adjust file name accordingly):
$ ./fastboot flash recovery twrp-3.2.3-0-20190311-codeworkx-cheeseburger.img
Sending 'recovery' (30448 KB)                      OKAY [  0.722s]
Writing 'recovery'                                 OKAY [  0.286s]
Finished. Total time: 1.019s
  1. When flashing completed successfully, use the volume keys on your OnePlus again to select “Recovery mode” and confirm via power button - this will take you to your fresh TWRP recovery
  2. TWRP will ask you if you will allow it to modify system partition - go ahead and swipe at the bottom to confim


Congrats! That’s it, your bootloader is unlocked and the custom TWRP Recovery installed.

Next up: OnePlus 5/5T: Installing Magisk root & xXx NoLimits ROM