The Google and Android developers out of Mountain View patched past available exploits found with Android Lollipop and now those updated to Android M as a Developer Preview must find the root access using a different and updated method.
- You must unlock the Google Nexus 6 bootloader before starting.
- Only use the Nexus 6 and no other Nexus device.
- Be running the latest Android M version, namely Developer Preview 2 with build number MPZ79M.
BEFORE WE BEGIN
- Download the Google USB Drivers  from this downloads page.
- Allow the USB Debugging permissions from the Developer Options menu.
- You are voiding any warranty you have left by proceeding past this point.
HOW TO ROOT THE GOOGLE NEXUS 6 RUNNING ANDROID M MPZ79M DEVELOPER PREVIEW 2
- Download the Android SDK package from the official developer’s website here .
- Set up the ADB and Fastboot  on a Windows computer. It’s possible to set it up on a different OS, just not using the guide we dropped in the link.
- Download Fastboot for Windows here .
- Download the Despair kernel here . Transfer it to the root of the SD card on the Nexus.
- Download the SuperSU here . Transfer the SuperSU from the desktop of the computer to the root of the SD card so it’s not in any folder.
- Download the TWRP Recovery image from here . Extract the custom recovery to the same folder where you have Fastboot.
- Turn of the Nexus device and boot it up again in Fastboot Mode by holding the Volume Down + Power keys together.
- Open the command prompt window inside the folder where you have Fastboot and the TWRP Recovery image. Right click the mouse and hold Shift on an empty space and choose to open the command window.
- Type your first command:
fastboot flash recovery openrecovery-twrp-18.104.22.168-shamu.img
- Your device will now boot up in the custom recovery mode.
- Choose the “Install” option from the recovery menu.
- Browse for the Despair.R20.6.Shamu.zip on the SD card and install it.
- Browse the internal SD card for the SuperSu and install it.
- Head back to the main recovery menu and choose to reboot that system and you’re ready to rock.