How do I set up a Raspberry Pi 3 using my Mac?
The Raspberry Pi is a superb microcomputer designed to help people learn about computing. Rather than a fully contained computer, like the Apple Mac, the Raspberry Pi is just a bare-bones board that you can hack into all kinds of electronics projects, but it offers huge potential at a price that's manageable for kids, students and amateur enthusiasts.
For just £30, it's no wonder that the Raspberry Pi has sold so well (it's currently the biggest-selling British computer). The latest model, the Raspberry Pi 3, features a much faster processor as well as on-board Bluetooth and Wi-Fi. It doesn't have a hard drive, however. Instead, you install the operating system directly on to an Micro SD Card and insert this into the Raspberry Pi. Several different operating systems are available, but most users opt for Raspbian (the recommended OS).
To set up Raspbian on a Raspberry Pi, you'll need a computer - a proper, conventional computer - to begin with. This is where Mac OS X steps in. It's really easy to set up a Raspberry Pi 3 using OS X on a Mac. You use OS X to format the SD Card, download Raspbian from the Raspberry Pi foundation and install the files on to the SD Card. This can then be plugged into the Raspberry Pi and booted.
There are two ways to set up Raspbian on a Mac. The first is to use NOOBS (New Out Of Box Software) and the second is to use the "dd" command in Terminal. In this simple tutorial we'll look at both options.
How to set up Raspberry Pi 3 with a Mac: Copying the NOOBS files
The easiest way to set up a Raspberry Pi on a Mac is to copy the NOOBS files from the Raspberry Pi organisation to a blank SD card. If this is the first time you've set up a Raspberry Pi, then we recommend you go this route:
- Download SD Formatter for Mac from this website. Open the SDFormatter.pkg file in your Downloads folder and follow the instructions to install the app. Use SD Formatter instead of Disk Utility (it uses the right format and creates the right partitions automatically).
- Attach an 8GB Micro SD Card to your Mac. (Be warned that the next steps will erase everything from the card.)
- Open SD Formatter and choose Overwrite Format (you can use Quick Format in the future).
- Click Format.
- When the format has finished, check that the SD Card has appeared in Finder.
- Open Safari and download the latest version of NOOBS from the Raspberry Pi organisation.
- Open Downloads and double-click the NOOBS zip file to unpack it.
- Open the NOOBS folder and drag all of the files from the NOOBS folder to the SD Card. Make sure you're dragging the contents inside the NOOBS_v1_9_0 folder and not the folder itself.
- After the files have finished copying open the SD Card and check that all of the files are in the root. You should see "bootcode.bin" and "BUILD-DATA" files, and a "defaults" folder (among other files).
- Eject the SD Card (drag the SD Card folder to Trash, or click the Eject icon next to it in Finder).
- Remove the SD Card from your Mac and insert it into the Raspberry Pi 3. Attach the power, HDMI cable and other peripherals.
- Attach the USB power cable to the Raspberry Pi.
You'll now see the Raspberry Pi boot into Raspbian, the default OS. You will see a grey screen with the Raspberry Pi logo on it.
How to set up Raspberry Pi 3 with a Mac: Copying the image file
Using NOOBS is the way to go for beginners, but as you continue using your Raspberry Pi you'll quickly want to switch to installing the operating system from the image file. This is smaller than NOOBS, so you get more space to use. It's also a faster installation and the process works for other operating systems, so you're not limited to Raspbian any more.
Unlike other computers, you'll end up re-installing the operating system on a Raspberry Pi far more frequently (it's designed to be set up, wiped and reused over and over again - it's a computer for prototyping).
Here's how to set up a Raspberry Pi 3 with a Mac using Terminal:
- Use SD Formatter to format your SD Card. Eject the SD Card and remove it from your Apple Mac.
- Open Safari and head to raspberrypi.org/downloads and click on Raspbian. Click Download ZIP under Raspbian Jessie (the full version, not Raspbian Jessie Lite).
- Double-click the Raspbian zip file in your Downloads folder to extract the image file. Ours is 2016-03-18-raspbian-jessie.img (you may have a later version).
- Open Terminal.
- Enter "diskutil list". You will see a list of all your drives. If you're using a Mac with just one hard drive, then two appear: /dev/disk0 and /dev/disk1. If you have external hard drives, or more volumes, then there will be more drives.
- Attach the Micro SD Card to your Mac.
- Enter "disktuil list" again. Check carefully to locate the new disk. It will be one more on from the last list (ours is /dev/disk2) and have "(external, physical)" after it. Check that its SIZE matches the SD Card. It's important that you get this right so you don't end up overwriting content on the wrong drive.
- Enter sudo diskutil unmountDisk /dev/disk[n] (replacing with the number of the disk, ie: /dev/disk2).
- Enter this carefully: "sudo dd bs=1m if=~/Downloads/2016-03-18-raspbian-jessie.img of=/dev/rdisk[n]" - replacing [n] with the number of the disk
- Tip: you can use tab to expand file paths in Terminal. Enter "if=~/Downloads/2 " and press Tab to get the rest of the filename (you may need to add "img" to the end).
The image file will be copied to the SD Card. You won't get any feedback while it copies, and it can take several minutes. Leave Terminal to do its thing. When the copy is finished enter "sudo diskutil eject /dev/disk[n]" to eject the disk. Remove the SD Card and insert it into your Raspberry Pi 3.