This is a cheatsheet on unlocking the HTC M9 based on two XDA forum posts. stifliz SIM Unlock post and this thread for T-Mobile users on changing the SKU. This method still requires a traditional unlock code (but it gets around the T-Mobile unlock tool method).
I followed this YouTube video to root the phone.
Change the SKU in the /system/customize/ACC/default.xml file from 11 (for TMobile) to 0. There's a complete list of SKU's here.
Use ES File Explorer and enable Root editing to modify the file.
Reboot the phone and then enter your unlock code.
I had to create an APN setting for AT&T to get the data and MMS to work. There are AT&T instructions on how to create the APN settings for Android.
I also had to disable the TMobile WiFi Calling feature.