Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mvandermeulen/02c9d8ba155fa5dee5d9511a09bc74f7 to your computer and use it in GitHub Desktop.
Save mvandermeulen/02c9d8ba155fa5dee5d9511a09bc74f7 to your computer and use it in GitHub Desktop.
Setting up headless Raspbian on macOS

Download the latest Raspbian Lite image from https://www.raspberrypi.org/downloads/raspbian/ (2020-02-13 at the time of this writing).

Insert your microSD card. Use balenaEtcher to burn the image to your microSD card.

Ensure the disk is mounted again, then enable SSH.

$ touch /Volumes/boot/ssh

If you're planning on using the built-in WiFi on the Raspberry Pi 3/Zero W or an Edimax EW-7811Un USB Wifi adapter (rtl8188cus chipset), add your Wifi configuration. Create the following file:

$ nano /Volumes/boot/wpa_supplicant.conf

And add this to it:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="[SSID]"
	psk="[password]"
}

Eject your SD card and insert it into your Pi.

Plug in your Pi and give it a minute to boot and connect to your network, either over Wifi or ethernet.

Copy your public SSH key the the Pi.

$ cat ~/.ssh/id_rsa.pub | ssh pi@raspberrypi.local "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Configure your Pi.

$ ssh pi@raspberrypi.local

$ sudo raspi-config

That's it! 🏆

Some ideas for next steps:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment