Google plans to launch the next version of Android, code-named Android M later this year. But the company has already released a developer preview which you can install and run on Nexus 5 and Nexus 6 smartphones, the Nexus 9 tablet, and the Nexus Player TV box.

This gives developers (and users) a chance to test out new features and make sure their apps are ready for Android M.

Want to root a device running Android M? Google doesn’t offer tools for doing that. But independent developers have figured out how to do it.

Here are the steps I followed to root my Google Nexus 5 smartphone running Android M.

n5 m root

 

There are two helpful guides for rooting the Nexus 5 at the xda-developers forum. One is by CronosTech, and the other is courtesy of ericgaebel, who also helpfully posts download links for all the files you’ll need.

Both guides basically use the same steps, and while ericgaebel has created a series of executable Windows batch files that kind of make his method into a toolkit, I found I had more success running some of the commands manually.

Note that there are a lot of steps because I’m trying to sort of hold your hand through the whole thing. But in a nutshell you’re just doing a few things: flashing a custom recovery and a custom kernel and then sideloading SuperSU and BusyBox. If all that sounds scary you might want to wait until there’s an easier method for rooting your device.

      1. Download and unzip the Miminal SDK from EricGaebel’s post.
      2. Connect your Nexus 5 to your computer with a USB cable and make sure USB debugging is enabled from your phone’s developer settings menu.
      3. Open a command window and navigate to the \Minimal SDK\Library folder.
      4. Type “adb devices” without the quotes to make sure your device is connected (you should see a list of devices).
      5. Type “adb reboot bootloader” to reboot into fastboot mode. (Again, don’t include the quotes — I’m going to stop mentioning that part from here on out.
      6. Once your device has rebooted into the bootloader, type “fastboot flash recovery twrp-2.8.6.1-hammerhead.img” to flash the TWRP custom recovery. You can also use one of the included ClockworkMod recovery tools if you’d prefer.
      7. Type “fastboot reboot” to reboot your device.
      8. Once Android has loaded, type “adb reboot recovery” to reboot into TWRP.
      9. Once TWRP has loaded, use the file browser on your computer to copy the BETA-SuperSU-v2.49.zip and Despair.M.HH.R1.5.zip files to your phone’s storage. You can put them in the root directory of the /sdcard or into a folder. Just make sure you remember where they are. (Note that the Despair file is a custom kernel. You can also use several other kernels including Hell’s Core for Android M instead of Despair).twrp
      10. On your phone, tap the button that says “install” and scroll down the /sdcard menu until you find the two files you copied in the previous step. Tap one, then select “Add More Zips” and select the second one.
      11. Swipe the slider at the bottom of the screen that says “Swipe to Confirm Flash.”

Once that’s done, all you have to do is reboot into Android and install BusyBox.

You could do this with an adb sideload command, but I did it by copying the busybox.apk file to my phone’s /sdcard, rebooting into Android, and then using ES File Explorer to locate and tap the apk file to install it. Make sure you’ve enabled installation of apps from unknown sources in the Android M settings, or this won’t work.

That’s it. If everything went properly, you should now have root access.

Why would you want root access? It gives you access to files and settings that wouldn’t otherwise be available and lets you run apps like Titanium Backup.

That app is pretty much the only reason I make a point of rooting most Android devices I use. It lets you not only backup all of the apps on your device, but also all of their settings including your login credentials, history, saved games, podcast subscriptions, and other preferences.

Since Android M includes support for automatic app backups which are saved to Google Drive, I’m hopeful that one day I might not need Titanium Backup anymore. But it’ll take a while for developers to tap into that particular Android M feature, so in order to regain access to all the apps and settings I was using in Android 5.1, I wanted to be able to restore from the last backup I had made before installing Android M.

Of course, installing a custom kernel and rooting your device means that you’re not running the exact same software Google released as a developer preview. This could cause problems with the way some apps or features function. It might give you a false impression of Android M’s performance. And it will almost certainly prevent you from being able to easily install over-the-air updates. So you might have to go through some or all of these steps again when Google releases future updates.

If you’re more of a visual learner, CronosTech has posted a video walkthrough:

Have a Nexus 6 rather than a Nexus 5? The steps for rooting that phone are similar… but you’ll need a different custom kernel.

Support Liliputing

Liliputing's primary sources of revenue are advertising and affiliate links (if you click the "Shop" button at the top of the page and buy something on Amazon, for example, we'll get a small commission).

But there are several ways you can support the site directly even if you're using an ad blocker* and hate online shopping.

Contribute to our Patreon campaign

or...

Contribute via PayPal

* If you are using an ad blocker like uBlock Origin and seeing a pop-up message at the bottom of the screen, we have a guide that may help you disable it.

Subscribe to Liliputing via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 9,547 other subscribers

6 replies on “How to root Android M on a Nexus 5”

  1. Should be “fastboot flash recovery twrp-2.8.7.1-hammerhead.img”. As far as I know, you need to tell fastboot which partition it is flashing.

  2. I was really hoping there’d be a method where I wouldn’t have to patch the kernel… Wanted to do a TWRP backup

Comments are closed.