If you are looking to increase the value of your HTC One M9 or gain root access you’ll need to first unlock the bootloader. The bootloader is the booting process which must be altered if we are to gain control of the internal system for flashing custom ROMs, custom recoveries and anything else that’s legal but away from the HTC business plan.
The guide below is only for the HTC One M9 released during 2015. Do not try the guide on the M8 or the M7 handsets.
BEFORE WE BEGIN
- The most important part is backing up your data such as call logs, SMS texts, pictures, videos, music files, phone contacts and other data you don’t want to lose. We must apply a full reset when unlocking the bootloader and doing that wipes all the data clean. You will lose everything. You can back up and restore that data later so you have it all back again.
- Backing up to the internal SD card is safe and will keep your data protected for a full restore later. You can also use third-party apps from Google Play such as Helium. Once you have root access you will probably prefer to switch over to the Titanium app from Google Play or take a NANDroid backup from inside the custom recovery of your choice. Install the up-to-date USB drivers on your Windows PC. You can find the HTC USB drivers  here.
HOW TO UNLOCK HTC ONE M9 BOOTLOADER
- Create your account at HTC Devs here .
- Download ADB and fastboot files .
- Verify your account at HTC Devs by viewing the email they sent after you registered. You only have 30 minutes to get that done for security reasons.
- Follow the new link here  and click to get started on the Unlock Bootloader section of the page.
- Unplug your M9 from the computer and boot it up in Bootloader Mode.
– completely Power Down by holding down the Power key and then reboot whilst holding the Volume Down + Power keys.
- Unzip the fastboot files you downloaded earlier. Right-click and hold down Shift inside the folder and open the Command prompt from the menu.
- Type this command:
- fastboot oem get_identifier_token
- highlight the text starting found between <<<< Identifier Token Start >>>> and ending with <<<<< Identifier Token End >>>>>.
- Cop yand paste that section of text to the page here  where it says Identifier Token.
- Now wait for another email from HTC with a Unlock_code.bin file.
- Copy the Unlock_code.bin file to the same folder where you unzipped the fastboot files.
- Close the Command Window and Open it again, this time type:
- fastboot flash unlocktoken Unlock_code.bin
- Look on the device display for a new massage telling you to confirm the bootloader unlock. Use the keys to confirm yes please.
- Wait for your device to reboot now with the bootloader unlocked.
Now every time you go to boot the M9 in bootloader mode it will tell you on the screen that the bootloader is unlocked. Only then are you safe to flash TWRP and gain root access with your M9.