I have always had some issues flashing latest images from google on to my Galaxy Nexus. The 'flash-all.sh' file never works. I always get a no file/directory error in terminal.
So if you are new to flashing images on OSX or just need a little advice on how to do it, continue to read this post.
Note: I am using examples of location I keep my SDK and files on my Mac. You may not have them in the same location.
I also take no responsibility to damage that may occur if you flash your handset, you do so at your own risk.
Step 1. Install the Android SDK from here and install.
*there may not be a file called fastboot (which is needed to flash on OSX) if not download from hereand place into the platform-tools directory in the sdk.
Step 2. Download the 4.2 Image from Google
Step 3. You need to unlock the bootlaoder of your handset to flash (this will erase all data on handset so make sure you back up all media files you want to keep etc.) Skip this set if you are already bootloader unlocked.
Power off handset. Put it into fastboot mode by pressing the power and volume + and - at the same time.
Connect the handset to the mac via usb cable.
Open Terminal and open enter fastboot location. I find it easier to drag fastboot file into terminal which also garantees getting the location right
then type 'oem unlock'
the command in terminal should look like this -
/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot oem unlock
Hit return to process the unlock.
Step 4. Put the handset back into fastboot mode if it's not already in it. Unzip the image file if you have already not done so.
In terminal enter the fastboot directory again (copy/past one from the terminal already or drag file again
At this point you can see if the flash-all.sh file will work for you or you can do it manually.
"/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot flash bootloader (drag file into terminal)"
/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot/ flash bootloader /Users/matthewattwood/Desktop/Android/Galaxy\ Nexus/takju-jop40c\ 2/bootloader-maguro-primelc03.img
Then reboot the bootloader.
/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot reboot-bootloader
Step 5. Flash the radio "/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot flash radio (drag file)"
/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot flash radio /Users/matthewattwood/Desktop/Android/Galaxy\ Nexus/takju-jop40c\ 2/radio-maguro-i9250xxlh1.img
Then reboot the bootloader.
Stage 6. -w update (image)
"/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot -w update (drag file to terminal)"
/Users/matthewattwood/Desktop/Android/Android\ SDK/platform-tools/fastboot -w update /Users/matthewattwood/Desktop/Android/Galaxy\ Nexus/takju-jop40c\ 2/image-takju-jop40c.zip
This will update the image/software as well performing the wipe of user data/cache etc. When finished it will reboot the device.