Setting up a Headless Raspberry Pi Zero

Alasdair Allan
9 min readMar 5, 2018

Most of the time when I use a Raspberry Pi, I’m using them ‘headless.’ Either the boards are embedded inside projects, or hidden away in a cupboard. While they’re connected to the network, there isn’t a monitor, keyboard, or mouse to be seen anywhere. However what seems to surprise a lot of people is that setting them up like that is actually now pretty easy.

Getting the Operating System

Go ahead and download the latest SD Card image of Raspbian, or if you don’t intend to ever use the Raspberry Pi with a monitor—or connect to it using VNC—of Raspbian Lite.

For burning card images these days I’d generally recommend Etcher, made by the folks at It’s cross platform — it works on Windows, Linux and mac OS — and lets you burn an image in four clicks.

Burning the aiyprojects-2018–01–03.img.xz card image using Etcher.

However, if you’re a command line person like me, you can either download and install the experimental Etcher command line tools, or you can still go ahead and do it the old way.

The instructions here are for the Mac, because that’s what I have on my desk, but instructions for Linux are similar.

Go ahead and insert the micro SD card into the adaptor, and then the card and the adaptor into your Macbook. Then open up a Terminal window and type df -h, and check the device name for your SD Card. In my case it’s /dev/disk1, and I’ll need to use the corresponding raw device, /dev/rdisk1, when writing to the card.

Go ahead and unmount the card from the command line,

$ sudo diskutil unmount /dev/disk1s1

rather than ejecting it by dragging it to the trash. Then from there we can go ahead and write the image to our SD card.

Unfortunately the card image came as a .xz file and there isn’t a command line tool to uncompress these sorts of file available by default on macOS. Fortunately, if you have Homebrew installed, you can brew install the xz command line tool. In the Terminal window change to the directory with your downloaded disk image and type,

$ brew install xz
$ xz -d aiyprojects-2018-01-03.img.xz

to uncompress the disk image, and then write it to your card as follows,

$ sudo dd bs=1m…