How to install LineageOS 16 on OnePlus 5T

The popular aftermarket Android firmware is available for the OnePlus 5T, making it possible for power users and professionals to get the most out of their phones.

Open-source LineageOS 16 based on Android 9.0 Pie improves privacy and security

OnePlus is typically regarded as one of the more responsive Android OEMs when it comes to providing security and software updates for phones, though some power users and professionals prefer the community-supported LineageOS distribution. The OnePlus 5T has official support for Android 9.0 Pie, though is also supported by LineageOS 16, giving users a choice between Android distributions. LineageOS also supports older devices from OnePlus and other Android device manufacturers for which official support has ended. Presently, the OnePlus 5T is the newest OnePlus device supported by LineageOS.

Getting started with LineageOS takes relatively more technical skill than simply installing an app, though can be performed in under an hour for a first-time user, provided instructions are followed to the letter, and necessary files are downloaded before beginning. Additionally, the following instructions are only for the OnePlus 5T (A5010). While the same basic principles of installation are applicable in broad strokes across other phones and manufacturers, each phone is fundamentally a unique device, and instructions written explicitly for your phone are necessary to install LineageOS or any other custom Android distribution.

Warning: Installing a custom Android distribution is likely to void your warranty.

Create a backup of the data on your phone before continuing.


You'll need the Android Debug Bridge (adb) installed on your computer. Instructions for installation are available here. For Linux users, it is easier to simply install android-tools through your package manager. You'll also need this custom TWRP and LineageOS build image for the OnePlus 5T (dumpling).

Optionally, download the latest GApps (Google Applications) package from Select "ARM64" as the platform, and "9.0" as the Android version. The "stock" variant is recommended.

Before installing LineageOS, ensure that the phone has been booted at least once, and is on the most recent official update before continuing. Ensure that all device PINs and fingerprints have been removed prior to starting.

Next, enable USB debugging. In the "Settings" app, scroll to the bottom and tap "About phone," and then tap on "Build Number" seven times. Press back, tap "System," scroll down, and tap "Developer options." Scroll down, and tap "USB debugging." Tap "OK." Scroll up, and tap "OEM unlocking." Tap Enable.

1. Preparing your environment

Connect your OnePlus 5T to your computer. From a command prompt or terminal window, type:

adb devices

Note: Linux users should run commands in this guide as root. Prepending "sudo" to these instructions is sufficient.

ADB should return text similar to:

List of devices attached
xxxxx   device

If multiple devices appear, ensure only the OnePlus 5T is attached to your computer, and try again.

2. Unlocking your bootloader

In the command prompt, type:

adb reboot bootloader

When the device is in fastboot mode, ensure it is visible to your PC by typing:

fastboot devices

Unlock the bootloader by typing:

fastboot oem unlock

A message will appear describing the consequences of unlocking the bootloader. To consent to unlocking the bootloader, press Volume Down twice, then press the Power button to accept. The phone will proceed to reboot, reset all user data, and reboot again. Because the data is reset, re-enable USB debugging by following the instructions in the second paragraph of "Prerequisites." (You'll need to accept the OnePlus and Google Terms of Service, but setting up an account, etc., is not necessary.)

3. Installing TWRP using fastboot

TeamWin Recovery Project (TWRP) is the most popular open-source custom recovery image for Android devices. It is useful for installing and managing alternative Android distributions. The custom TWRP by codeworkx adds support for Project Treble on the OnePlus 5T. (This may not be necessary with newer official versions of TWRP.)

In the command prompt, type:

adb reboot bootloader

When the device is in fastboot mode, ensure it is visible to your PC by typing:

fastboot devices

Flash the TWRP recovery image onto your device.

fastboot flash recovery twrp-3.2.3-0-20181227-codeworkx-nocompatcheck-dumpling.img

After this is complete, on the OnePlus 5T, press Volume Down three times until the text at the top says "Power off." Press the power button.

With the device powered off, hold Volume Down and press Power to boot into the recovery image. The TWRP logo will appear. Swipe right to allow modifications.

4. Installing LineageOS & Open Gapps from recovery

For the sake of safety, tap Backup to create a backup in the event something goes wrong. The default selected options are acceptable. This backup does not include files in internal storage, such as pictures or downloads.

Copy the backup from Internal Storage > TWRP > BACKUPS before continuing.

Tap Back twice to return to the main menu. From there, tap Wipe. Tap Format Data. Read the prompt on the OnePlus 5T and follow the instructions. This will remove encryption on the device, and delete files in the internal storage.

Tap Back twice. Tap Advanced Wipe. Select "Cache" and "System" partitions, then Swipe to Wipe.

Return to the main menu.

From the main menu, tap "Advanced," then "ADB Sideload," and swipe to begin sideloading.

On your computer, type

adb sideload

If you wish to install Google Apps, follow the steps to start ADB Sideloading again, and type

adb sideload

Select "Reboot device," but do not install the TWRP app.

You can now set up your OnePlus 5T running LineageOS 16.

Also see

Image: Andrew Hoyle/CNET