Sunday, January 11, 2015

Flashing a microSDHC in OS X 10.10 Yosemite for the Raspberry Pi Model B+

First, check out the Quick-start if you're totally new or the Installing Operating System Images on Mac OS documentation which hopefully should be up-to-date and more comprehensive. I'm just documenting this here from what I did a few weeks ago so that I don't lose it! :) I'm going to write this though for the non-tech savvy, just in case someone gets a Raspberry Pi B+ and really doesn't know what to do.

DO THE FOLLOWING AT YOUR OWN RISK. DOING THIS INCORRECTLY COULD LOSE ALL OR PART OF THE DATA ON YOUR COMPUTER. BE WARNED! I AM NOT RESPONSIBLE FOR YOUR ACTIONS.

First, if you didn't get one already, you'll need a microSDHC card and probably a MicroSDHC to SD Adapter.

Now download a disk image, probably from the Raspberry Pi Downloads page. This may take a long time.

In spotlight (click the magnifying glass to the upper-right), type terminal and enter.

In terminal, type:

diskutil list

This is the incredibly important part (and I'm not kidding). There is something on the left of each section that is output that tells you the identifier for each disk device, like /dev/disk0, /dev/disk1, /dev/disk2. Probably the first few will have things like Apple_CoreStorage, Apple_Boot, or Apple_HFS somewhere next to them. Those are NOT the ones you want. You need to look for the SD card, under that. It may not be obvious what it is, so be careful and don't accidentally erase an external drive, etc. In my case, it was /dev/disk2. Write that down!

Now, to attempt to unmount the card if it has been mounted, do this, replacing /dev/disk2 in the command with whatever disk is your SD:

sudo diskutil unmountDisk /dev/disk2

To flash your SD/microSDHC card, do this, replacing the part after if= with the pathname of your image and replacing the part after of= with whatever disk is your SD:

sudo dd bs=1m if=~/Downloads/2014-12-24-wheezy-raspbian.img of=/dev/disk2

That will probably also take a long time, and it just sits there, so don't assume it's locked up. After it's complete, remove the card and the microSDHC from that card and put the microSDHC into your Pi (it's a non-descript port on the side of the Pi), then just power it on after connecting a monitor or TV to the HDMI port. At the very least, you'll also want to plug a USB keyboard into it. When it comes on, it will go into setup. Note that after you setup and reboot, the default user is pi and default password is raspberry if you didn't change it.

Last thing: LATER if you want to erase the SD you flashed and make it a normal blank FAT32 formatted SD for use in a camera, etc., you'll need to erase the MBR (master boot record). To do that, use diskutil again to get the right disk number and do this command, replacing the part after of= with whatever disk is your SD:

sudo diskutil eraseDisk FAT32 SDCARD MBRFormat /dev/disk2

No comments: