Skip to content

Instantly share code, notes, and snippets.

@vibs2006
Last active February 28, 2026 17:42
Show Gist options
  • Select an option

  • Save vibs2006/345b52000653453e44bc0c425cd50b52 to your computer and use it in GitHub Desktop.

Select an option

Save vibs2006/345b52000653453e44bc0c425cd50b52 to your computer and use it in GitHub Desktop.
Lineage 16 OS Step by Step Installation Guide for outdate Nexus 5 Mobile

πŸ“± Install LineageOS 16 (Android 9) on Google Nexus 5 β€” Complete Beginner's Guide

Platform: Windows 10 | Device: Google Nexus 5 (hammerhead) | ROM: LineageOS 16.0 (Android 9 Pie)


⚠️ Important Warnings Before You Start

πŸ”΄ ALL DATA ON YOUR PHONE WILL BE ERASED! Back up everything first.

πŸ”΄ Follow each step in order. Do NOT skip any step.

🟑 Keep your phone charged to at least 60% throughout the process.

🟑 If something goes wrong, do not panic β€” you can always reflash.


πŸ“¦ PHASE 1 β€” Download Everything You Need

Download all files before you begin. Save them in a single folder, e.g., C:\Nexus5Flash\

What Where to Download
βœ… ADB & Fastboot (Platform Tools) developer.android.com/tools/releases/platform-tools
βœ… Google USB Driver developer.android.com/studio/run/win-usb
βœ… TWRP Recovery for Nexus 5 dl.twrp.me/hammerhead/ β€” See detailed instructions below ⬇️
βœ… LineageOS 16 ROM for Nexus 5 XDA Thread β€” Download the .zip file
βœ… GApps (Google Apps) MindTheGapps β€” Pick arm, Android 9.0

πŸ’‘ Tip: Extract the Platform Tools ZIP into C:\Nexus5Flash\platform-tools\


πŸ“₯ How to Download TWRP Recovery .img for Nexus 5

⚠️ The official TWRP website (twrp.me/lg/lgnexus5.html) only shows device info and buttons β€” the actual .img file is hosted on a separate download server.

The latest and last official TWRP build for Nexus 5 (hammerhead) is:

File: twrp-3.7.0_9-0-hammerhead.img

You can download it in two ways:

πŸ”΄ Security Warning: Only download TWRP from official TWRP servers (twrp.me or dl.twrp.me). Never download .img files from random third-party sites β€” they could be tampered with and harm your device.

After downloading, save the file inside C:\Nexus5Flash\ and rename it to:

twrp-3.7.0_9-0-hammerhead.img

πŸ”§ PHASE 2 β€” Set Up ADB & Fastboot on Windows 10

Step 1 β€” Install Google USB Driver

  1. Extract the Google USB Driver ZIP you downloaded.
  2. Connect your Nexus 5 to the PC via USB.
  3. Open Device Manager (right-click Start β†’ Device Manager).
  4. Find your Nexus 5 (may show as "Unknown Device").
  5. Right-click it β†’ Update Driver β†’ Browse my computer β†’ point to the extracted USB driver folder.
  6. Click Next and install.

Step 2 β€” Add ADB to Windows PATH

  1. Press Windows Key + S, type "Environment Variables", open it.
  2. Under System Variables, find and click "Path" β†’ click Edit.
  3. Click New and add: C:\Nexus5Flash\platform-tools
  4. Click OK on all windows.

Step 3 β€” Test ADB Works

  1. Open Command Prompt (press Win + R, type cmd, press Enter).
  2. Type:
adb version
  1. You should see something like: Android Debug Bridge version 1.0.41 βœ…

πŸ“± PHASE 3 β€” Prepare Your Nexus 5

Step 4 β€” Enable Developer Options

  1. On your Nexus 5, go to Settings β†’ About Phone.
  2. Tap "Build Number" exactly 7 times rapidly.
  3. You'll see: "You are now a developer!" πŸŽ‰

Step 5 β€” Enable USB Debugging & OEM Unlocking

  1. Go back to Settings β†’ Developer Options (now visible at the bottom).
  2. Turn ON β†’ USB Debugging
  3. Turn ON β†’ OEM Unlocking

Step 6 β€” Connect Phone & Verify ADB Sees It

  1. Connect Nexus 5 to PC via USB.
  2. On the phone, a popup will appear: "Allow USB Debugging?" β†’ Tap Allow / OK.
  3. In Command Prompt, type:
adb devices
  1. You should see something like:
List of devices attached
XXXXXXXX    device

βœ… If you see your device listed, you're good!


πŸ”“ PHASE 4 β€” Unlock the Bootloader

πŸ”΄ This will WIPE all data on the phone! Make sure you've backed up everything.

Step 7 β€” Reboot to Bootloader (Fastboot Mode)

In Command Prompt, type:

adb reboot bootloader

Your phone screen will show a green Android robot with text. This is Fastboot/Bootloader mode. βœ…

Step 8 β€” Verify Fastboot Sees Your Phone

fastboot devices

You should see your device serial number listed. βœ…

Step 9 β€” Unlock the Bootloader

fastboot oem unlock
  1. On the phone screen, use Volume Up/Down to navigate to "Yes" and press the Power button to confirm.
  2. The phone will wipe itself and reboot. This is normal! βœ…
  3. Once it reboots to the setup screen, skip setup (don't sign into Google yet).
  4. Re-enable USB Debugging again (repeat Steps 4 & 5 β€” the wipe resets all settings).

πŸ”΅ PHASE 5 β€” Flash TWRP Recovery

TWRP is a special recovery mode that lets you install custom ROMs.

Step 10 β€” Reboot Back to Bootloader

adb reboot bootloader

Step 11 β€” Flash TWRP

Navigate Command Prompt to your folder first:

cd C:\Nexus5Flash

Then flash TWRP using the exact filename you downloaded:

fastboot flash recovery twrp-3.7.0_9-0-hammerhead.img

You'll see OKAY when done. βœ…

πŸ’‘ If you downloaded a different version, replace the filename accordingly.

Step 12 β€” Boot Into TWRP

  • On your phone (still in bootloader), use Volume Down to scroll to "Recovery mode".
  • Press Power to select it.
  • TWRP will launch β€” a blue/dark interface. βœ…
  • If it asks to "Keep System Read Only?" β†’ Swipe to Allow Modifications.

πŸ“‚ PHASE 6 β€” Transfer ROM & GApps Files to Phone

Step 13 β€” Push Files to Phone via ADB

In Command Prompt (while TWRP is open on phone):

adb push C:\Nexus5Flash\lineage-16.0-XXXX-hammerhead.zip /sdcard/
adb push C:\Nexus5Flash\MindTheGapps-9.0.0-arm-XXXX.zip /sdcard/

Wait for both transfers to complete (may take a few minutes). βœ…

πŸ’‘ Replace the filenames above with the actual names of the files you downloaded.


⚑ PHASE 7 β€” Wipe & Flash LineageOS

Step 14 β€” Wipe the Phone (Factory Reset in TWRP)

  1. In TWRP, tap Wipe.
  2. Tap Advanced Wipe.
  3. Check all of these boxes:
    • βœ… Dalvik / ART Cache
    • βœ… System
    • βœ… Data
    • βœ… Cache
  4. Swipe the bar at the bottom to confirm the wipe.
  5. Wait until done, then tap Back. βœ…

Step 15 β€” Install LineageOS ROM

  1. In TWRP main menu, tap Install.
  2. Navigate and select your LineageOS ZIP file.
  3. Swipe to confirm Flash at the bottom.
  4. Wait for it to complete. βœ…

Step 16 β€” Install GApps (Google Apps)

  1. Tap Add More Zips (or go back to Install).
  2. Select your MindTheGapps ZIP file.
  3. Swipe to confirm Flash.
  4. Wait for it to complete. βœ…

Step 17 β€” Wipe Dalvik Cache Again

  1. Tap Wipe β†’ Wipe Dalvik / Cache.
  2. Swipe to confirm.
  3. Done! βœ…

πŸš€ PHASE 8 β€” First Boot!

Step 18 β€” Reboot to System

  1. In TWRP, tap Reboot β†’ System.
  2. If it asks "Install SuperSU?" β†’ Tap Do Not Install (unless you want root access).

⏳ The first boot takes 5–10 minutes. This is completely normal! Don't panic or reboot during this time.

Once it boots, you'll see the LineageOS setup wizard. Set up your phone like new! πŸŽ‰


βœ… Full Checklist β€” Did You Complete Everything?

  • Downloaded all required files
  • Downloaded TWRP .img from dl.twrp.me/hammerhead/
  • Installed ADB, Fastboot & USB Drivers
  • Enabled Developer Options & USB Debugging
  • Unlocked Bootloader
  • Flashed TWRP Recovery (twrp-3.7.0_9-0-hammerhead.img)
  • Wiped the phone (Advanced Wipe)
  • Flashed LineageOS 16 ROM
  • Flashed GApps
  • Wiped Dalvik Cache
  • First boot successful! πŸŽ‰

πŸ†˜ Common Issues & Fixes

Problem Fix
adb devices shows nothing Re-plug USB, re-approve debugging popup, reinstall USB driver
fastboot devices shows nothing Try a different USB port or cable; reinstall driver via Device Manager
Phone stuck on boot logo Reboot into TWRP, redo Dalvik/Cache wipe, then reboot system
TWRP .img file not found on twrp.me Use the direct link: dl.twrp.me/hammerhead/twrp-3.7.0_9-0-hammerhead.img
TWRP not launching after flash Redo Step 11; make sure you used twrp-3.7.0_9-0-hammerhead.img
App says "requires newer Android" Known limitation β€” Nexus 5 is hardware-capped at Android 9
fastboot oem unlock not working Make sure OEM Unlocking is enabled in Developer Options (Step 5)
TWRP asks for password on Data Just tap Cancel β€” it's an encryption prompt, safe to skip

πŸ“š References & Resources

  1. Install LineageOS on hammerhead β€” LineageOS Wiki
  2. Using ADB and Fastboot β€” LineageOS Wiki
  3. LineageOS 16.0 for Nexus 5 β€” XDA Forums
  4. TWRP Device Page for Nexus 5 (hammerhead)
  5. TWRP Direct Downloads for Nexus 5 (hammerhead)
  6. MindTheGapps β€” GApps for Android 9
  7. Google USB Drivers for Windows

πŸ‘€ Author

Tutorial compiled by vibs2006 with assistance from GitHub Copilot.
Feel free to share, fork, or improve this guide!


Last updated: February 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment