How To: Unlock the Bootloader & Root Your HTC One M8

Unlock the Bootloader & Root Your HTC One M8

As with most OEMs, HTC would like you to think that you can do virtually anything with your new HTC One M8, but as a softModder, you know that isn't true. To actually unleash the full potential of that device, you need access to the whole system, not just the parts that HTC deems okay for you to mess with.

To truly reach your M8's full potential, you will first need to unlock your bootloader and root your device. By unlocking the bootloader, you grant your phone the ability to install custom recoveries, mods, and ROMs. With the custom recovery, you can root your device to gain administrator access, which allows you to modify the parts of the device's system that spell doom for some, but open doors for softModders.

Now, I've already shown how to unlock and root the HTC One M7, but I'm gearing this one specifically for the new M8 with Android 4.4 KitKat, so there's no confusion. These instructions will also work for the M7, though.

The Prerequisites

Before getting started, you need to get a few of the basic necessities out of the way first. Make sure you check off all of the following before moving on to the first step.

  1. Make sure your phone is at least 60% charged.
  2. Register for an account at HTCdev.
  3. Enable USB debugging in your phone's Developer options.
  4. Un-check "Fast boot" on your phone by going to Settings -> Battery Manager.
  5. Install ADB and Fastboot on your computer.
  6. Make sure to back up all of your app data using either ADB or HTC Sync, because you will be wiping your phone.
  7. Install the HTC One M8 drivers on your computer (if you have HTC Sync installed, then you already have them).

Unfortunately, Verizon thought it best to keep you from unlocking your bootloader, so you'd have to use a different method to gain root access to your device.

How to Unlock Your Bootloader

After you've met all of the prereqs above, it's time to unlock your bootloader. This must be done prior to rooting, as mentioned above.

Step 1: Enter Fastboot Mode

Place your device into fastboot mode by plugging in your HTC One to your computer, then powering it down by holding both the Power and Volume Down buttons until you see the screen below.

Step 2: Locate Your Identifier Token

Once the screen above appears, open up a terminal (command prompt) on your computer. To get the right Unlock Code for your HTC One, you first need to get your device's specific Identifier Token, so type the following into your terminal window, followed by the Enter/Return key.

  • fastboot oem get_identifier_token

Step 3: Copy the Token

Now copy the code you get, but do not include the first (bootloader) portions.

Step 4: Log into HTCdev

Go to HTCdev and log in to your account.

Step 5: Get Your Code Emailed to You

Select Unlock Bootloader and then Get Started.

From the drop-down menu, select HTC One (M8) (or just HTC One for the older M7 model, if that's what you're unlocking), then click on Begin Unlock Bootloader.

Agree to the terms and conditions and click Proceed to Unlock. On the next page, scroll all the way down and click on Proceed to Step 5.

Now paste the identifier token you copied in Step 3 into its corresponding box near the bottom (called My Device Identifier Token) and click Submit.

Step 6: Download the Unlock Code

The Unlock Code will be emailed to you, so once you receive the email, download the attachment and place it on your Desktop.

Step 7: Initiate the Unlock Code

Back in the terminal prompt, type the following.

  • fastboot flash unlocktoken Desktop/Unlock_code.bin

Change Desktop/Unlock_code.bin to the location of your code.

Step 8: Confirm on Your HTC One

Your phone will now prompt you to unlock your bootloader, so using the Volume Up button, select Yes and confirm your unlock with the Power button.

Your phone will now reboot and your bootloader will be unlocked!

After the reboot, you will need to set up your device again as if it were new. After getting set up, make sure to re-enable USB debugging and plug it back into your computer.

How to Install TWRP Recovery & SuperSU

Now it's time to instill root privileges on our device, and to do that, we have to install both a custom recovery (in this case, TWRP) and SuperSU.

Step 9: Download SuperSU

Start by grabbing SuperSU from Chainfire directly on your phone, or download and place the file in your device's "Download" directory.

Step 10: Enter Fastboot Mode

Just like we did back in Step 1, place your device into fastboot mode.

Step 11: Download TWRP

Now download the appropriate TWRP recovery file for your particular wireless carrier and edition below.

  • If you have an AT&T, T-Mobile, Developer, or International edition HTC One, go to this page to download the TWRP recovery.img file.
  • If you have a Sprint HTC One, go to this page to download the TWRP recovery.img file.

Step 12: Flash Your Recovery

Now let's flash your downloaded TWRP file to your HTC One. Type one of the following commands into your terminal window, depending on which file you downloaded above.

For the AT&T, T-Mobile, Developer, or International editions, type:

  • fastboot flash recovery Desktop/openrecovery-twrp-2.7.0.2-m8.img

For the Sprint edition, type:

  • fastboot flash recovery Desktop/openrecovery-twrp-2.7.0.2-m8_whl.img

Step 13: Erase the Cache

Once you get the Success message from ADB, type fastboot erase cache to prevent any boot loops.

Step 14: Boot into Recovery

Back on your HTC One, highlight Bootloader (using your Volume keys) and hit the Power button to confirm. In bootloader mode, select Recovery and hit the Power button again to boot into recovery mode. Your device will now reboot into TWRP.

Step 15: Install SuperSU in Recovery & Reboot

Tap the Install option and select the SuperSU .zip you downloaded earlier, then swipe along the bottom bar to install.

After the install finishes, go ahead and hit Reboot System.

Congratulations, you are now officially rooted!

Now That You're Rooted, Where to Next?

Once your device reboots, you will have a new SuperSU icon in your app drawer and the ability to grant apps root access to your device. This will come in handy when using apps like Xposed Installer.

You will also be able to restore your data the same way you backed it up (if you used the ADB method), so re-enable USB debugging, if you hadn't done so above, and get the restore process started.

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

120 Comments

Bro! Thanks so much for this thorough step by step written guide for Mac owners. The video is super helpful as well.

First of all, thank you for the guide for Mac's, very clear and helpful. I have one question. Is it possible to gain root without flashing a custom recovery? IE; could I flash and install the supersu zip from terminal and gain root that way?

I know that's not a common way of doing things, but I really just want to play with Xposed, S6Toolbox, and keep stock recovery for any OTA's that come along. I'd rather re-root after an OTA than install custom recovery in other words.

Thanks again for the guide.

Thanks, glad I could help.

You'd need to install supersu via a custom recovery, but you could always reflash the stock recovery after. Let me know what M8 variant you have and I can link you the recovery you need.

You could try the weak sauce root method, but thats usually a hit or miss.

I looked into weaksauce, apparently won't work with my model, others have tried. I have a UK unlocked M8. Really appreciate you taking the time to reply.

Thanks for the great instruction with step by step.
However, i am not able to get the token from fastboot mode or via HTCdev instruction.
The terminal shows," -bash: fastboot: command not found"
May i ask what to do?

One more question, should i update the upcoming 4.4.3 version through official software updates after rooting ?

Thank you so much.
I am currently using asia version, 2.5 GHz model

If you are getting that error from terminal it means you do not have fastboot installed. Follow this guide to get it installed.

It would be up to you how you want to update, but if you want to install through the official OTA you will need to have a stock recovery.

Really thanks for your reply :)

I followed the guide, it shown Have a nice day already. Afterward,i typed "fastboot oem getidentifiertoken", however, its still shows " -bash: fastboot: command not found" again.

i have no password for by mac, so I typed ctrl-c. i tried to use return key but its shows "Sorry, try again." :(

It looks like the install script didn't finish properly. The easiest way to fix this is to unzip the Android.zip again and copy the contents of the Mac folder to your /usr/bin/ folder.

To get to that folder open a finder window and hit Shift, Command, and G at the same time and type /usr/bin/ and copy the adb and fastboot files there. You will have to enter your password to complete the copy.

THANKYOU Holy fuck i've been trying to solve that for 5 hours +
you are awesome

hi could you please help me out .. everytime i try to flash twrp via command prompt i end up with msg
C:\Users\fahad>fastboot flash recovery Desktop/openrecovery-twrp-2.8.0,1-m8.img
error: cannot load 'Desktop/openrecovery-twrp-2.8.0,1-m8.img'
please help
i tried all of twrp files

Have you released a video on how to do it to a M8 on Verizon yet? You mention it in the video that its coming, but I can't find the video on your site.

Does it have to be the dev edition or any Verizon m8. I read it was only for the dev edition.

Weaksauce works for any Verizon M8

ive completed everything up to step 13 but the boot loader option is not appearing on the screen. any suggestions?

Unplug your device and reboot into bootloader mode by holding the volume down and power buttons. From there you should see the option to boot into recovery.

Does this method work with the Harmon Kardon Edition (Sprint)? Many thanks.

This should work fine on a Harmon Kardon edition One, just be sure to download the correct TWRP file.

Hey, thanks for the step by step! I'm currently stuck on step 7. It keeps saying Error: "cannot load Unlock_code"

I've moved around files, changed directory, etc and it either says the above or "No such file or directory" I tried reinstalling ADB and Fastbooter (your zip) files several times and I'm pretty sure it's installed... Any ideas?

Are you entering Unlock_code.bin or just Unlock_code?
And I assume you are using a Mac right?

I had downloaded the supersu app to the phone but there is no zip file i can find on step 15 so how would i fix this

Where did you place the supersu.zip on your phone?

Unlocking bootloader failed!

We're sorry, but it appears your attempt to unlock the bootloader on this device has failed. This could be caused by several factors including simple errors in the entry of the unlock token, problems with your device, or a lack of manufacturer support for the unlocking process. Please see the specific error code listed below, and try again if necessary.

Error Code: Invalid Bootloader Token Length.
Error Reason: The submitted Token appears to be the wrong length and won't work. HELP HELP HELP?

That means you copied the unlock token incorrectly. Make sure you do not miss any characters when you copy it over.

I had to individually copy each line without the bootloader begining

Start at the identifier token start, then double click on each line cmd-c then cmd-v onto the htc website.

Alternatively, you can copy the entire thing to notepad or any text editor, search the phrase "(bootloader) " using the find function, and replace-all while leaving the replacement field blank.

You may wish to make this more clear. It reads like you only skip the first one on the first line. I failed a few times because I didn't know enough to remove all of them from each line.

Thanks for the great guide!!

This looks like a simple guide but I cant get past step 1 with my phone. I have a Koodo HTC One M8 (Canadian). Whenever I try to enter fastboot mode it just prompts me to reboot by pressing "power" and "volume UP" buttons. Pressing "power" and "volume down" buttons only takes a screen shot, or when my screen is off it just mutes my phone. I have done all the previous preparations in this how to guide. Do you have any ideas? Thanks.

Are you holding down both power and volume down for 15 seconds? Even if it takes a screenshot continue holding down the buttons. And be sure to disable fast boot from the power settings.

Instead I shut my phone down, then turned it on while holding power and volume down. Now everything is going smooth. :)

Thanks. I was having exactly the same problem and what you did worked. Turning it ON using volume down and power worked for me.

In 15 minute and my sim lock is gone, i buy code for HTC ONE M8 from safeunlockcode.com. Exactly works on any sim card within a minutes.

I deleted stock OS on accident, NEED HELP!

Not sure how you did that, but if you have a custom recovery you can use this guide to restore a ROM through adb.

hi Andrew
i try to follow your guide to flash a new rom cause i did remove my rom too but my sideload wont start.
Hope you can help me.
oh i have TWRP v 2.7.1.0 and i'm from the netherlands

if i do swipe to start sideload after a while there comes a open lock and i only can swipe to unlock over and over again :-(

Louis

Did you already send over the ROM.zip with adb?

Nope!!! but ill gonna try it right now.....and now it seems to work Andrew the trick is to keep your phone awake during the sideload and then give the adb command to flash your rom i have the Viper rom now up and running!!!!! thank you very much Andrew :-) Its a great guide!!!!

My device is rebooting every few minutes after rooting. What in the world?

Oh, I did the erase cache part. It gets into the OS and lets me use it for a while, then reboots

Try to update the superSU app. If the binaries are out of date that may cause your issue.

Aye I was just coming here to say I figured it out! Thank you a ton buddy

No problem, glad you got it fixed!

Hey Andrew, I just sent you a message. Could you ready when you can? Thank you.

this is what i get at the last step of unlocking the bootloader....

It looks like you changed the directory of terminal to your Desktop so just enter:
fastboot flash unlocktoken Unlock_code.bin

hey thanks for this it worked except one problem. Now that im rooted I cant seem to install apps from the playstore. theye usually get stuck at 97 percent or just say installing forever.

Try clearing the data from Settings -> Apps -> Google Play Store -> Clear Data

"Step 3: Copy the token" - An easy way to copy all that text
1) Right click anywhere inside the cmd
2) Click on 'Mark'
3) Now hold down the left mouse button and drag over the text you want to copy.
4) Release the left mouse button, then right-click to copy any highlighted text.

What theme are you using?

wow i suck. i went to terminal and put "fastboot oem getidentifiertoken" but it says "-bash: fastboot: command not found". am i the only one with this problem, what should i do

Did you install ADB and Fastboot on your comp?

can i use these steps in windows 7?
if yes i will use cmd instead right?

Yup, it will work with cmd on Win7.

I have a silly question.

After installing the custom ROM from Insert Coin, do I have to repeat these steps all over again? I asked because I don't see SuperSU app after installing the custom ROM.

PS - This comment should have actually been in S-off page. Sorry.

No problem. Insertcoin comes rooted and if you selected the option to hide superuser it should be in your settings app.

Hello, I got to step 15, and then when I boot into recovery I get a red triangle with an exclamation mark in it. Any ideas?

That means TWRP did not flash properly. Redo that step and everything should be fine.

im seeming to have a very serious problem around step 11 when i try to download teamwins htc one m8 for sprints GooManager its simply not there or available to download. or even in step 12 its not working when i try and flash the recovery. Please help me. also when they say i have to save the .img file to the root of your phone i do not understand how to do that. its not deatailed enough.

im attempting a backup using flashify for my htc one m8 for sprint but like twrp or the uncompatible version of goomanager i had its saying i still do not have root access to my phone which i dont understand shouldnt i if i successfully reached step 11 and unlocked my bootloader?

After you unlock the bootloader you need to flash TWRP. Don't use GooManager to install it. You will need to flash it using fastboot and terminal/cmd.

What errors are you getting when you try and flash?

sorry i actually was able to continue the root process, i think i got confused through the steps. But this article was very helpful thank you!

This might sound dumb, but I cannot figure out how to get the TWRP Recovery file onto my phone.

Edit: Jeez nevermind. I didn't realize I didn't do that until the next step.

good morning

can you do this for a HTC One Remix for Verizon? I have jailbroke iPhones but never rooted a Android. Also i want to Sim Unlock it is that possible? please help if you can, I'm using a Macbook Pro 13 retina if that makes a diff

I am not sure if this will work for the Remix, but you can try Towelroot and see if it can root your device.

hey, i get to step 7 and everything works fine but nothing comes up on my phone (htc one m7ul) to let me unlock the bootloader like it does int step 8, seriously stuck

using viper rom if that makes a difference, so already rooted

If you have already flashed a ROM through TWRP then you should already have an unlocked bootloader.

hey, in step 5, my identifier code doesn't show up? how do i fix this?

It looks like you have not installed fastboot on your Mac yet. If you ran the script in my other guide and still get this error you will need to extract the zip again and move the adb and fastboot Mac files manually to /usr/bin/. You can get there by opening Finder and pressing Command+Shift+G.

Hey Andrew! So I'm starting the process of making my China version HTC one to a normal one,but I kind of get stuck,when I enter the command to get the token,it says "waiting for device

" and nothing else happens, i have installed Adb and HTC sync to get the drivers,hope you can help me,thanks!

When you enter the command fastboot oem get_identifier_token does your bootloader menu say FASTBOOT USB?

Hi Andrew; I'm having the same issue José was, and no, my menu does not say FASTBOOT USB. Should it? :o

EDIT: Never mind. I figured it out too! Lol, forgot to actually select fastboot :)

nvm I figured it out

I have my Htc one and it reboots every minutes by it self. Does anybody know how they could help me out by telling me how I can fix that please??

Have you flashed any mods or deleted any system files?

Hi, great guide so far, but i'm having problems getting the TWRP file and flashing my HTC, any tips? I've followed your instructions but keep getting this error msg.

Did you place the img file on your Desktop? Try to rename the file to something different as well.

I downloaded supersu from the playstore directly on my phone so in step 15 I would just go ahead and reboot?

NVM I got it sorted out thanks for the step by step instructions everything worked great!

No problem! Glad you got everything figured out.

well i ran a backup on my phone and i didnt have anything installed to go run my phone... i have been on the same white HTC Logo screen when you first turn on the phone for over 15 minutes now.... help

I cant get my m8 to do any methods from bootloading to getting s-off

Are you saying fastboot doesn't recognize your device when it is in bootloader mode?

So, I am on the last step but I can't seem to install SuperSU. I just go into a folder with nothing in it. I can't swipe and install anything.

Well, when I went to reboot it asked me if i wanted to install supersu. Thank you for this guide. It was extremely helpful!!

Stop there. help me please please please :'(

Redownload your unlock code and try again.

I am S OFF, SuperCID, Have installed TWRP recovery but I need to root and unlock my HTC One M8 can anyone tell me how to do it?

Can I root (flash supersu from TWRP without unlocking my device to get) root? and then unlock my device either though HTCdev or from XDA (No need to go though HTCdev hassle which I prefer)

You can use this XDA guide to unlock without HTCdev. After that you can flash TWRP and the supersu zip.

Yes, I was considering the same but would like to tell you that, that guide requires root and supersu before I use those commands. How do I root and install Supersu first?

Edit: I have latest version of TWRP installed already and I am S OFF, SuperCID

When you reboot from the TWRP menu you will get a notification to install SuperSu if you aren't rooted. If you are rooted the notification will not display and you will be ready to use the linked guide.

I don't have "Fast boot" option in Settings -> Battery Manager on my HTC one m8t. What can I do?

Don't worry about that. As long as you can boot into bootloader mode you will be fine.

Is there any difference to the steps if I've updated to Lollipop?

On the HTC Dev site there is no Mexico supportdo you have any other method to unlock bootloader?

This is only way right now. Do you get an error when you try and submit your identifier token?

Hello

I am on Mac, and succesfully I got token id, after I copied the adb and fastboot files to usr/bin folder. But when I type adb devices in the terminal, it t says: List of devices attached, but there is no any list or device identifier number

Also, when I type: adb reboot bootloader it says: error: device not found

What could be the problem?
I am on lollipop, on stock, i didnt do any method, just to get the token id. Do i have to open HTC sync manager?

EDIT: I just figoured out, that adb commands works just simply plug the device. =) sorry I am new here

Is it possible tod o this off my Xbox One?

I'm not sure I understand your question. This guide is meant for the HTC One smartphone.

Can I do this without rooting my device?
Also the link to twrp gives 404 does anyone know where i could find an htc one m8 twrp download?

So you want to just unlock your bootkoader without rooting?

I was entering the recovery mode but it doesn't load, I waited for so long, it stuck at the "this build is for development purposes only Do not distribute outside of HTC. Failed to comply may lead to legal action.

What can I do?

Hey there! Wonderful article with very thorough explanations.
Unfortunately I am stuck on step 14 just like the last comment from someone else 4 days ago.
"entering recovery..." I did use the latest TWRP (2.8.7.0)

Please help! My phone is stuck on that screen!

hello, I did all the steps up to number 8 there select YES, press power and nothing happens if you select no then restarts and nothing happens. I have a HTC Desire 300, bought in the UK, I understand that the UK usually do figure this

Your phone does not restart once you hit Yes?

No restart If I select yes, but if I select no then restarts

Was working already

is there a guide that would work with an android?

Stuck on step 7, I keep getting
C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flash unlocktoken Desktop/Unlockcode.bin

error: cannot load 'Desktop/Unlockcode.bin'

Edit: Nevermind, i got it. all i had to do was move the unlock code into C:/Program Files (x86)\Minimal ADB and Fastboot folder

I'm trying to unlock my AT&T branded m8, but I'll be moving it over to a new carrier. Would I still download the twrp file for At&T? Also after I wrote out all the steps since my internet service isn't great I noticed this was a guide for using a Mac, is there much difference using a Windows 7 PC?

Done everything. now my m8 is stuck on the boot screen.. help. please

Hey Andrew i need some help from you if this is possible im kinda stuck right now!? I want to fastboot the twrp file

Cedrics-Air:Android cedricsmacbook$ ./fastboot flash recovery twrp.img
target reported max download size of 16777216 bytes
sending 'recovery' (14818 KB)...
OKAY 1.552s
writing 'recovery'...
OKAY 0.629s
finished. total time: 2.181s
Cedrics-Air:Android Cedricsmacbook$

this works but only without the command openrecovery-twrp.img and after that i want to boot into recovery but it doesn't open the twrp to install super-Su instead of that it shuts off and i have to wait till the battery is by 1% till i can turn it on again my device is already unlooked and i don't really know how to get this problem fixed maby you know how to fix this?! Kings regard Cedric

Please help am getting the following error
target reported max download size of 14675968 bytes
Invalid sparse file format at header magi
error: writesparseskip_chunk: don't care size 5433344 is not a multiple of the block size 4096
sending sparse 'recovery' (14328 KB)...
error: writesparseskip_chunk: don't care size 5433344 is not a multiple of the block size 4096
error: writesparseskip_chunk: don't care size 5433344 is not a multiple of the block size 4096
OKAY 1.569s
writing 'recovery'...
FAILED (remote: image error! (BootMagic check fail))
finished. total time: 1.596s

Share Your Thoughts

  • Hot
  • Latest