After a long wait, Android M Developer Preview is finally made available for users of Nexus 5, Nexus 6, Nexus 9, and Nexus Player to download and install. We have a quick tutorial planned out below for you to make things bit eased up.
Make sure that this Developer Preview is just for testing purpose and not yet cleared for general usage so we highly recommend you to first create backup of your data before moving forward to avoid any regret.
Step 1: Download Android M Developer and save its content and files into a separate folder on your computer where you can easily reach
Step 2: To further proceed, you need to have an ADB and Fastboot on your Mac. If you are lucky enough to have it already then just proceed to next step, or if you do not, then copy paste the highlighted command on your Terminal App: bash <(curl https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh). Pasting this command will automatically install and configure ADB and Fastboot on your Mac.
Step 3: Now move to System Preferences, then to Keyboard, select Shortcuts and choose Services
Step 4: Once you have chosen it, you will see a long list having certain items checked or unchecked. Make sure to put a check against New Terminal at Folder
Step 5: Now begin Terminal at folder by right clicking the folder of Android M that you downloaded earlier and clicking New Terminal at Folder option.
Step 6: Now you need to unlock your bootloader. If you have already done this then move to next step. If you have not then you need to connect your device to your computer with a USB port quickly and copy paste the highlighted command into Terminal: adb reboot bootloader. Doing this will put your device into bootloader mode. Now you need to unlock it, do this by copy pasting this command: fastboot oem unlock
Step 7: Once your device has unlocked bootloader, reboot the device in Fastboot mode. You can do this by completely turning off your device and then press and hold volume up, volume down, and power button altogether to initiate the Fastboot mode on your device
Step 8: Make a note of it that your device need to be connected to your Mac via USB port this whole time. Open the Terminal app and copy paste the highlighted command to flash Android M image: sudo ./flash-all.sh
All good? Now wait for a while and let Android M flashing to complete its process. Once it is done, your Nexus will reboot automatically to Android M welcome screen.