How to root the Nexus 5

nexus_5_rooted_headerBefore you root your device please understand that this can and most likely will void your warranty! Also keep in mind that when this procedure is complete, you will need to go through the phones initial setup process and reinstall your applications.

Steps to root your Nexus 5

Nexus 5 with SuperSU installed.

 

  1. Download the ZIP click here.
  2. Extract the ZIP file.
  3. Boot your device into bootloader/fastboot mode.
    1. Power down your Nexus 5.
    2. Power on your device by holding the power button and at the exact same time volume up and volume down buttons. (Hold the volume down button first, then press and hold power)
  4. Connect your Nexus 5 to your computer using a USB cable.
  5. Run the appropriate script to automatically root your Nexus 5! Using the appropriate command line tool in your OS run the following:
    1. Windows
      1. Run root-windows.bat
    2. Linux
      1. chmod +x root-linux.sh
      2. Run root-linux.sh
    3. Mac OS X
      1. chmod +x root-mac.sh
      2. Run root-mac.sh

 

 

 

NOOB TIP: While in bootloader mode, use the volume up and volume down keys to navigate up and down the list and then use the power button to select your choice.

Script Terminal Output

When you run the script it may ask you for a password depending on your account setup on your computer. I am using OS X 10.9 Mavericks (yes, a mac).

$ cd ~/Desktop/CF-Auto-Root-hammerhead-hammerhead-nexus5
$ chmod +x root-mac.sh
$ sh root-mac.sh

----- CF-Auto-Root-hammerhead-hammerhead-nexus5 -----

Please make sure your device is in bootloader/fastboot mode before continuing.

***WARNING*** ALL YOUR DATA *MAY* BE WIPED ! ***WARNING***

We are going to run the OEM UNLOCK command on your device. If your device
was not previously unlocked, this will wipe all your data !

After the unlock, CF-Auto-Root will boot. You should see a big red Android
on your device's screen.

You may need to enter your administrator password to continue.

Press Ctrl+C to cancel !

Press ENTER to continue

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
< waiting for device >
... OKAY
Password:
downloading 'boot.img'... OKAY
booting... OKAY

It may take a minute or so for the red Android to appear. If it doesn't show up
at all, there may be a problem.

Press ENTER to continue

Donate

“CF-Root has been available for many devices and has clocked over 17.5 million downloads. This is not even counting custom ROMs that already include it. Don’t be a leech, buy me a beer (and use the “Thanks” button!). Imagine if every CF-Root user has donated me $1… “-Chainfire

Here at Phandroid, we couldn’t agree more. Please, if you can… donate to Chainfire for his awesome efforts!
Click here to donate to Chainfire

Join Us in Our Forum

If you have any questions or issues you can always find some help in our forums… please visit our Nexus 5 forum!  You will find me personallywatching the Nexus 5 activity over there. ;)

[via Chainfire on G+]

Continue reading:




  • Unorthodox

    After all these years, it’s so funny to realize that someone still needs a script to do all this.

    • http://stevealbright.com Steve Albright

      A lot of users need a script for this.

      • Unorthodox

        And I don’t disagree. I’m just saying that after 5 years of rooting, flashing, and fastbooting it doesn’t seem like an exercise at all. Go Android, I’m glad that acceptance rate is so high these days.
        I was at my ophthalmologist’s today, and out of about 30 people in the waiting room, only ladies past-their-40ies had iPhones.

        • ManiacalShen

          Well, some of us only change ROMs every 3-6 months and are prone to forgetting things. I tore my Galaxy S1 apart and reflashed it umpteen times, but I don’t much mess with my S3 anymore. And different phones have had slightly different procedures, too.

          • Unorthodox

            I meant Nexus devices. They are all the same, since the bootloader is unlockable. There is not even a command line key you need to memorize, all commands are in plain English p (well, somewhat ;) ).

      • http://google.com/+derekross Derek Ross

        IMO, if you need a script, you shouldn’t be rooting… unless you now what you’re doing and you’re lazy. Everyone should at least their first time, do it manually to gain the proper knowledge of what they’re doing, just in case something goes wrong.

        • Chainfire XDA

          You’d better elaborate _exactly_ what you consider a manual root and would make someone “worthy” … :)

          • http://stevealbright.com Steve Albright

            Hey, look who showed up! ;) Welcome and thanks for all your Android efforts!

          • http://google.com/+derekross Derek Ross

            Haha. Obviously I don’t mean compiling an insecure kernel and doing all the work your script does. I meant pushing su and superuser.apk and then setting permissions. Sorry buddy. You can slap me next year at the BBQ ;)

          • http://stevealbright.com Steve Albright

            Upvote for slap.

          • StacyD

            No, what Derek is getting at is the barrier of entry.

            Cf auto is great for lots of devices that would be near impossible otherwise or made substantially easier.

            We did have the partitions early on this guys and could make a recovery early as well. There really isn’t a need here and given the barrier of entry being low with normal nexus methods, its not entirely needed in this case.

            Maybe that is what Derek was trying to say.

            BTW sorry about missing u at the hangout the Thursday before the BBQ. I was there, but left at 11pm…. Boo myself.

          • StacyD

            Yeah, even I don’t bother with doing a true manual root….

            You could go a bit more extreme and compile AOSP with ENG or TEST tags and get SU anyway. I needed to do it to add the Menu button to the bottom for myself (then just force push the new framework file).

            I get your argument. It depends on what the end goal is. A good portion of people are rooting to get a custom recovery on there when the same end goal can be achieved the other way around. People are not wrong about your software, it is totally worthwhile. I even worked with you a while ago to get about 3-4 devices set up under CF-auto!

            Nexus gives a lot of options on how to do this.

            Maybe Derek and I were pointing to two different things. I was just saying to fastboot it…

            There really isn’t anything to get angry about here. More is better.

            Let just make sure that people know what having root access available really means. Scripts are good things. Pretty much all exploits run off of a script or a binary of a script. Zergrush…

        • Unorthodox

          I up-voted, but on the other hand – there’s a lot of basic knowledge involved to understand what the hell is a “partition” 8-) And it’s not the driver’s curtain in a limo..

    • TONY ALDO

      Scripts are awesome.

  • toomuchgame441

    Yea… I’m going with the LG G2, superior hardware… and the support for this device seems to be great

    • unglued94ta

      :edit: Yea… I’m going with the LG G2, *identical* hardware *except for buttons*… and the support for this device seems to be *just as* great *as every other nexus device ever made*

      • toomuchgame441

        Nah I had it right the first time

        • unglued94ta

          I’ll admit the g2 probably has a better camera but that’s it. I’m still puzzled as to why you posted your original comment when this article has nothing to do with the g2. So I decided to feed the troll. ;-)

  • http://stevealbright.com Steve Albright

    This is just a quick how to for Unlocking the Nexus 5. If you would like more advanced tutorials along with installing a custom recovery… please upvote this comment. That will raise my self-esteem and also let me know these kind of more technical posts are needed for our obviously uber smart user base ;)

    • xdapao3

      Upvoted but for a moment there I thought about downvoting just for using a frigging MAC!! LOL
      No knowledgeable poweruser ever uses Apple crap. Ever.

      • aergern

        @xdapro3 Sure they don’t. Like myself and the rest of the techops dept I work in and our entire eng, qa and dev teams. It’s UNIX with lipstick and only a dipstick uses Wintendo based machines for anything but games.

        • xdapao3

          I don’t have a single game installed on my Windows 7 laptop (nor I have any on my Note II smartphone). I wasn’t talking about working with computers “for” other computers, I was talking end users. The most powerful, feature complete, consistent and easily mastered *desktop OS* is Windows (7 and the 8′s desktop environment), period.
          OSX is an incoherent mess, a total clusterf*ck.
          P.S. and since you talk about that stuff, I am an ex-expat who has worked in IT all over the world…

      • http://stevealbright.com Steve Albright

        Fun Fact: About 80% of Googlers (Google Employees) use a Mac.

        So that beloved Android OS… most likely a majority of it was designed and coded on a Mac. I have used Linux for many years… but like @aergern:disqus stated below, it’s UNIX with lipstick. I love UNIX and I don’t have time to fuss with Linux. OS X provides a wonderful OS (had better support before iPhone) that works damn well for my needs. I have a bunch of powerhouse apps that I use all the time and reboot like once a month. My MBP is pretty badass and keeps my workflow flowing. Thank you for not downvoting just because I use a Mac.

        • xdapao3

          Fun fact: I am an ex-expat who has worked in IT all over the world and I am retired at 39 (since a couple of years actually).
          I am at the very least as “good” as the average Googler and my *informed* and not-humble-at-all opinion on OSX as a consumer/prosumer *desktop OS* is that it is utter CRAP.
          N.B. not dissing its Unix “base” (which is still NOT a consumer desktop OS BTW) but the Apple “layer” on top of it.

          • http://stevealbright.com Steve Albright

            That’s fine with me. I am not concerned about any OS that anyone uses except for me or my wife (since I would be maintaining/fixing/helping). You are lucky to have worked all over the world.. I am sure that is great experience. I have a computer networking background personally and have used, managed, supported all kinds of OS’s including both server and desktop infrastructure. As I value your opinion and allow you to use Windows, please give me the same respect and value my choice as I know OS X is currently the operating system that is best for my needs.

          • xdapao3

            I don’t (I can’t) agree with your choice from whatever POV but I of course respect it. I was just kidding man :) (hint: “LOL”)
            Now, if you were an iOS user too… well, that I CANNOT respect!! :P

        • StacyD

          I would agree, if you are a pure application developer.

          Working with the NDK on Mac compared to something like Linux Mint or ugh Debian is aweful. ndk-build never seems to work right. I say this owning computers with OSx, Linux , ESXi, win7 and win8.1. I have done application development on all for android. For doing apps, Linux and OSx are about even. Oh and Googlers use Linux or Mac because they cannot use windows and not every Googler is a firm techie. Many people are still afraid of Linux. Guys, its plug and play now.

          Gradle 1.6 seems to work better in Linux as well. I never have that Android studio crashes in Linux like I do on MAC either.

          Steve, if you ever have to cross compile a library for android on OSx or do an Android.Mk file, have fun buddy. Relink and local c flags might burn you.

          • http://stevealbright.com Steve Albright

            Fair enough. I would be curious what the Linux percentage at Google is and what distribution. I know Linux has come a long way since I have used it and I have a few boxes sitting around …for fun?..if I ever have free time?

            I haven’t had any crazy issues with Android Studio or Gradle but have not yet made the full commitment yet. I have been using IDEA forever and will stick with that until Android Studio is a stable release.

            As for LOCAL_CFLAGS on OS X, they can be quite confusing at times. I have this bookmarked..ha: http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html#Invoking-GCC

            I use Android.Mk quite a bit for that extra lower level c code to provide just one more layer for the important stuff. Nothing major so I have not got burnt yet! H/T

          • StacyD

            In my group , we run 100% Linux. We also all run the same distro base.

            Some of that is because of how we have a lot of things set up.

            If you are security concerned, Linux can be a better option as you can set up your SELinux (which is in basically every modern distribution as sent out) policy and have things monitored. That is impossible in the current state of OSX as well as some of the weird mappings.

            If you end up getting heavy in NDK with lots of JNI layers, some aidl you might want to make the switch. At least a VM (which is nice because you can have a real backup of your env. and code).

            You also get a little speed boost.

            One thing is that I couldn’t get a Mac laptop with a docking station, 32gb of ram, has well i7, and set it up with Dual HDD slots. Having everything on SSD makes “make clobber &&make bacon- j12″ take about 45min and not freeze anything.

    • StacyD

      Just see my instructions above: http://disq.us/8g079a

      Yeah. I already did it…

      • http://stevealbright.com Steve Albright

        A lot of people have already done it. If you did, that is great… but please keep in mind this is an article that is targeted for the users that have not. Not everyone understands those commands let alone familiar with cmd prompt/terminal. If they understood what you posted they would most likely be able to read the same thing by opening the script. Your comment does not provide any of the files needed and would just confuse a first time rooter.

        I would rather you help others than boasting your experience. Your comments just seem a little arrogant, thats all.

  • phinn

    Love how easy it is to root a Nexus. Sadly I’m stuck on Verizon since my work pays the bill.

  • ShirtlessKirk

    Why would rooting require app reinstallation? Does this method wipe the device (and if so, the hell with that, no device I’ve ever rooted has screwed around with installed apps)?

    • ItAintYouItsMe

      Unlocking bootloader wipes all Nexus devices. Wiped my Nexus 7 when I first rooted it.

      • ShirtlessKirk

        Not the same thing. Yes, unlocking bootloader wipes the device, however, you still aren’t rooted. Rooting in and of itself doesn’t wipe devices as it is just a privilege escalation.

  • pr0xidian

    Chainfire is an android god haha.

  • GeoSnipes

    mine keeps saying waiting for device… :(

    • http://stevealbright.com Steve Albright

      If your device is not being detected, make sure you are in debug mode.

  • StacyD

    Jeez guys. THIS IS DEAD SIMPLE.

    Download TWRP: http://techerrata.com/browse/twrp2/hammerhead

    1. Boot into the Bootloader (VOL+, VOL – System

    7. TWRP will warn you about no SU, select Install

    BOOM.

    If this takes more than 10min, you are crazy.

    FYI, ROOTING FOR NEXUS DEVICES HAS NOT CHANGED IN MANY YEARS. If you cannot figure it out by now, well…. maybe you should not root.

  • Jae

    why does mine keep say waiting for device i even put in debug mode :(

    • http://stevealbright.com Steve Albright

      So you have the device in debug mode but it’s still not seeing it. Are you sure your in the correct bootloader mode? Wouldn’t be a bad idea to just test a second USB cable.. I have had that happen before ;)

  • ανώνυμος

    This just made waiting for the in-store T-Mobile release even more difficult…

    …Can’t wait until I get out of my Verizon contract.

  • Matt

    Alright, I’ll admit: I’ve never rooted a device. Verizon GNex was my first smartphone, and I was too paranoid that I’d mess something up and brick my first smartphone that I never rooted it. I just got a Nexus 5, switched to T-Mobile, and want to download an app that requires root access. Steve, based on one of your comments below, the procedure in this OP is only half the total process? If I were to follow only the instructions above, would I still have a functioning N5, or are there further steps in the process to close the loop?

  • MERKJONES

    I just got my phone like 20 minutes ago and ran through this just fine, however; there is now a software update for KitKat that’s like 125.8MB. Let’s see if I keep root.

    • MERKJONES

      I think I lost root as a result. All good, I’ll do it later.