If you've updated your Nexus 5 to Android 6.0 Marshmallow and want to root it, we have the tutorial for you below. The tutorial is for a Nexus running Android 6.0 and will work for any of the most recent builds (regardless of the monthly security patch number). We're rooting a Nexus 5 on build number MRA58N, and we'll also be installing a custom recovery to do it.
There are a few things you need before we get started: an unlocked bootloader, USB Debugging enabled and ADB Tools installed on your computer. Please note that unlocking the bootloader will wipe your device, so please back up your data first.
How to install a custom recovery on the Nexus 5
Because we're not rooted at this point, we'll need to flash a custom recovery without root. The steps below will take you through installing a custom recovery, flashing a rootable kernel (I'll be using ElementalX but there are others you can substitute) and then rooting your Nexus 5 with SuperSU installed.
1. On your computer, download TWRP for the Nexus 5.
2. Rename the file you just downloaded to recovery.img (if your computer doesn't show the .img extension just rename the file to recovery) and move it to the ADB Tools folder where the ADB and Fastboot files are located.
3. Grab your Nexus 5 and reboot to the bootloader. To do this turn it off, then press and hold Power and Volume Down until you see the menu with Start written in green. This is Fastboot mode, also known as the bootloader.
4. Connect your Nexus 5 to your computer with a USB cable.
5. If you followed the tutorial above, you should have an unlocked bootloader at this stage. If you don't, you can do it now, but be reminded that the process wipes your device, so again, make sure you have a backup of your data. If your bootloader is already unlocked, skip the next two steps and continue with flashing TWRP (step 8).
6. To unlock the bootloader, navigate to the ADB Tools folder on your computer, hold the Shift button and right-click the mouse, and select Open command window here. Type: adb devices to ensure your Nexus 5 is recognized. If it isn't, make sure you have the correct drivers installed on your computer and try again.
7. In the command window, type: fastboot oem unlock
8. Now we can flash a custom recovery (TWRP) via Fastboot. In the command window, type: fastboot flash recovery recovery.img
9. Disconnect the USB cable once the recovery file has finished writing.
10. On your Nexus 5, use the volume buttons to highlight recovery and press the Power button to select it.
11. On the TWRP screen, swipe the slider to the right to make TWRP your default recovery.
12. In TWRP, tap Reboot > System but do not let TWRP try to root your phone.
How to root the Nexus 5 on Marshmallow
Now you can download a rootable kernel and SuperSU for your Nexus 5, which you can now flash through custom recovery on your phone. As mentioned above, I'm flashing ElementalX kernel but you can substitute another if you wish.
2. Once you've downloaded both files, reboot your Nexus 5 to the bootloader again (turn it off, press and hold Volume Down and Power).
3. Now, use the volume buttons to highlight recovery and press Power to enter TWRP.
4. Tap Install and navigate to the kernel you downloaded (unless you moved it, it should be in your Downloads folder).
5. Tap the kernel file and slide the slider to flash it.
6. Once the kernel has been flashed, tap the home button.
7. Tap Install and navigate to the SuperSU file (which should also be in your Downloads folder).
8. Tap the SuperSU file and slide the slider to flash it.
9. Once it has completed, tap the Reboot System button.
10. Once your Nexus 5 has rebooted, go to the Play Store and install Root Checker to verify you now have root. When you get a green pass message, you're done (just be sure to grant Root Checker's superuser request when you launch the app).
What's the first thing you're going to do with a rooted Nexus 5?