Prerequisites to root Nexus 5:
- Download and install Android SDK. Follow this guide to properly install and configure Android SDK.
- Enable USB debugging on your device. Follow this guide to know how to enable USB debugging.
- Backup sensitive data such us apps, contacts and messages. Following this guide will erase your device’s data.
- Install drivers. Install any of the following. [ Driver 1 | Driver 2 | Driver 3 | Driver 4 ]
Once you have fulfilled the requirements, continue reading further. Rooting your Nexus 5 is a 3 step process – Unlocking Bootloader, Installing custom recovery and Rooting.
Step 1: Put your device into bootloader mode. To do so, switch off your device by holding Volume Down and Power button. You can also put your device into bootloader mode by tying in following command in CMD or Terminal.
[quote]adb reboot bootloader[/quote]
Step 2: Connect your device to the computer.
Step 3: Open CMD or Terminal and type on the following to confirm that the drivers are properly configure. If the drivers are installed and your device is connected properly, you’ll see your device’s ID on the terminal.
Step 4: Type the following in CMD or Terminal. This step will wipe everything off your device.
[quote]fastboot oem unlock[/quote]
Step 5: You will be prompted with a warning message. Use the volume keys to highlight Yes and select it using the Power button. The bootloader will now be unlocked.
Step 6: Reboot your device using the following command
Step 7: Your device will reboot and you will be presented with a screen showing the android logo and a progress bar. This will take up to 10 minutes to complete.
Installing Custom Recovery
Step 1: Put your device into bootloader mode. To do so, power off your device by holding Volume Down and Power buttons simultaneously. You can also put your device into bootloader mode by tying in following command in CMD or Terminal.
[quote]adb reboot bootloader[/quote]
Step 3: Put the downloaded recovery image file ( .img ) on your desktop. If it is inside a compressed file, extract it.
Step 4: If you are running Windows, open CMD and type in the following command.
If you are using Linux or OSX, open Terminal and type in the following command.
Step 5: Now we flash the recovery.
- To flash CWM recovery, type in the following command. Replace x.x.x.x with the build number of downloaded recovery.
[quote]fastboot flash recovery recovery-clockwork-x.x.x.x-mako.img[/quote]
- To flash TWRP recovery, type in the following command. Replace x.x.x.x with the build number of downloaded recovery.
[quote]fastboot flash recovery openrecovery-twrp-x.x.x.x-mako.img[/quote]
- Or, you could just rename the recovery image into recovery.img and flash it using the following command
[quote]fastboot flash recovery recovery.img[/quote]
Step 6: Restart you device by selecting Restart Bootloader by using volume key and tapping the power button. After the bootloader loads, use the volume key to select Recovery Mode and tap the Power button.
Step 1: Download the latest SuperSU flashable .zip package from here.
Step 2: Connect your device to the computer and transfer the downloaded SuperSU .zip file to your SD Card.
Step 3: Without disconnecting the device, type the following command in the CMD or Terminal.
[quote]adb reboot recovery[/quote]
Step 4: When your device boots into recovery mode, disconnect your device from the computer.
Step 5: Flash the SuperSU package.
- If you are using CWM, tap on install zip from sdcard > select the SuperSU .zip file > select Yes to start flashing
- If you are using TWRP, tap on Install > select the SuperSU .zip file > Swipe to start flashing.
Step 6: Once the flashing is finished, reboot your device by selecting reboot system now (CWM) or Reboot > System (TWRP).