Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 29 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save celeryclub/8f74c76a641310462ab3 to your computer and use it in GitHub Desktop.
Save celeryclub/8f74c76a641310462ab3 to your computer and use it in GitHub Desktop.
Setting up headless Raspberry Pi OS on macOS

Download the latest Raspberry Pi OS Lite image from https://www.raspberrypi.com/software/operating-systems/ (2022-04-04 at the time of this writing).

Insert your microSD card. Use Raspberry Pi Imager to burn the image to your microSD card. Make to select "Set username and password" in the config before starting. Name the user pi and select your own password.

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/4/Zero W, 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:

@artburkart
Copy link

Awesome, thanks for sharing :)

@celeryclub
Copy link
Author

Glad you found it useful!

@johanndiedrick
Copy link

Thank you so much for this!

@spicymaya
Copy link

Really great. Thank you! Made the set up so quick and easy!

@theoctober19th
Copy link

I followed every steps, but cannot ssh to pi@raspberry.local because it asks for password. Tried raspberry but didn't work.

@celeryclub
Copy link
Author

Thanks for pointing this out @theoctober19th. In the latest version of Raspberry Pi OS (2022-04-04), the "pi" user has been removed. I've just updated the section about writing the image with instructions on how to create the "pi" user.

@arvindpant
Copy link

Thanks @celeryclub for making setup for easy:)

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