Raspberry Pi OS Headless Setup

When you don’t have or feel like hooking up a monitor and keyboard

Photo by Jeff Loucks on Unsplash

We will be installing a headless version of the Raspberry Pi OS, which can
be downloaded from the Raspberry Pi Foundation here: https://www.raspberrypi.org/software/operating-systems/

As of April 2021, the three downloads available are:

  1. Raspberry Pi OS with desktop and recommended software
  2. Raspberry Pi OS with desktop
  3. Raspberry Pi OS Lite

We will be downloading Raspberry Pi OS Lite, which is a headless version of the OS. That is, there is no graphical user interface available. We will instead enable the SSH server as part of the installation process and login via an SSH client.

After downloading the OS Lite ZIP file, we need to extract it to an IMG file and then flash it to a microSD card (8GB minimum). Once the card is flashed, eject it and reinsert the SD card into your computer. You should now see a volume called `boot`. On MacOS, this will be located at `/Volumes/boot`.

Open a terminal and navigate to the boot volume:

If you list the files `ls`, you should see a collection similar to the following:

To enable the SSH server, simply add a file named `ssh` to this directory:

If you’re going to connect the Raspberry Pi to your network directly via an ethernet cable go ahead and skip the next step, otherwise follow along. Now we’re going to provide WiFi credentials with a text file called `wpa_supplicant.conf`. Open up your preferred text editor and create `wpa_supplicant.conf` inside of the `/Volumes/boot` directory with the following content:

This configuration file is setup for a primary (`priority=2`) and a secondary (`priority=1`) WiFi network. That is, if both of the networks above are available, the one with the highest priority value will be the one the Raspberry Pi attempts to connect with. If you don’t have more than one network, the second block can be ignored. Substitute the credentials you have for `ssid`, `psk`, and `id_str`, for the Wifi SSID, password, and a unique ID of your choosing, respectively. Once this file is saved, eject your microSD card and insert it into the Raspberry Pi. Provide power to the device and check your WiFi router to see if it’s connected.

My WiFi router serves up a web interface on ``. Check your router for this info as well as a username and password. After checking the connected devices on my WiFi network, I see there’s a device with a hostname of `raspberrypi` and IP address ``. Note that your IP addresses will most likely be different.

Let’s login to the Raspberry Pi with our SSH client. Open a terminal and type the following (note use your Raspberry Pi’s IP address in lieu of

You will likely get a warning such as `The authenticity of host ‘ (’ can’t be established […] Are you sure you want to continue connecting (yes/no/[fingerprint])?`. Go ahead and enter`yes` and you’ll be prompted for a password. The default password is `raspberry`. After a successful login, you’ll be greeting with a terminal similar to the following:

Go ahead and run the following commands to make sure your OS is completely up to date:

Congrats! You’ve successfully installed a headless version of Raspberry Pi OS and connected via SSH.

Fullstack Systems Engineer @ Technicity LLC, Runner, Transplant Carioca.