Being a Nexus device, it was just a matter of a few hours before developers managed to gain access on the Nexus 5. Like every other Nexus device, rooting the Nexus 5 requires an unlocked bootloader.
Since by default the Nexus 5 comes with a locked bootloader, unlocking it will wipe the internal storage of the handset. So, before you proceed to root the handset, make sure to backup your data.
Step 1: The first thing you need to is to unlock the bootloader on your Nexus 5. You can follow this step-by-step guide, which will work on Windows as well as Mac and Linux based PCs.
Step 2: Once you have unlock the bootloader, let your device boot into Android OS. You can enter your Google credentials right away, or after you have rooted the device. Now, download the SuperSu ZIP file from here and transfer it to the root of the internal storage on the Nexus 5. Download the Nexus 5 compatible TWRP recovery from here and transfer it to the ‘google’ folder you created on your desktop while unlocking the bootloader. Rename this file to ‘hammerhead.img’ for simplicity purposes.
Step 3: Reboot your device into fastboot mode by pressing the Volume down + Power button. Now, connect it to your PC and enter the following commands, one by one.
The above command will make sure that the device has been detected by your PC. Mac users, make sure to prefer a “./” before every fastboot command, e.g. ./fastboot devices.
Now, we need to flash the recovery on the device using the following command -:
fastboot flash recovery hammerhead.img
Step 4: Once the recovery has been flashed, you need to reboot your Nexus 5 into Recovery mode. Using the Volume keys on the device to navigate, find the ‘Recovery’ option and select it by pressing the Power button.
Step 5: After booting into recovery mode, tap the ‘Install’ button and then select the SuperSU ZIP file you had transferred to the device in Step 1. After the ZIP file has been flashed, reboot your device into Android OS.
Congrats! You have successfully managed to root your brand new Nexus 5.
Alternatively, if the above steps are too troublesome for you, download and install these drivers. Then, use Chainfire’s CF-Autoroot to automatically root the Nexus 5 in a single step. However, you are more than likely to run into one or the other error while rooting the device.