Warning : Flashing the android M developer preview 3 will erase entire data stored on your nexus device. So before doing anything backup your data.
Nexus 5 (GSM/LTE) hammerhead : hammerhead-MPA44I-preview-2ebbc049.tgz
How To Install Android 6.0 Marshmallow [Android M Developer Preview 3] On Nexus 5
- Download and install android SDK. This also includes Google USB drivers.
- Download the android Marshmallow system image for Nexus 5 from above and unpack it in android sdk>platform-tools folder.
- Enable USB debugging on your Nexus device by going to ‘Settings>Development>Debugging’.
- Power of your phone. Connect the nexus device to PC.
- Enter into bootloader mode by pressing and holding ‘volume up’, volume down and power button. Alternatively connect the phone to PC and open a command window in platform-tools folder and run the command ‘adb reboot bootloader’.
- Execute the command ‘fastboot oem unlock’. A prompt will appear on your phone to confirm. It will wipe entire data.
- Now execute ‘flash-all.bat’ command. If you are using a MAC then type ‘flash-all.sh’. This will install the latest android M developer preview 3 on your Nexus 5.
- After flashing you can again lock the bootloader by typing the following command and executing 'fastboot oem lock'.
- Now go on testing the new android 6.0 Marshmallow.
Note : If anytime you want to go back to your original android firmware then download the nexus image from Google Developers and flash it by using the above procedure.