How to setup a Raspberry Pi 3 headless, without monitor, mouse or keyboard

by Jannik Arndt

I bought a raspberry pi as a smart home automation server. Here’s how to set it up without connecting a monitor, mouse or keyboard. All you need is an ethernet cable.

1. Prepare the SD card

  1. Download Raspbian from
  2. Copy it to the SD card, using
    • ApplePi Baker or
    • Etcher or
    • your Terminal: bash sudo dd bs=1m if=[path to img file, e.g. "2017-08-16-raspbian-stretch.img"] of=[path to rdisk, e.g. "/dev/rdisk2"] conv=sync
  3. Enabled ssh access for one start by creating an ssh file in the boot folder: bash touch /Volumes/boot/ssh
  4. Eject the SD card (via the button in Finder or diskutil eject /dev/disk2)

2. Prepare your Mac

You need to enabled Internet Sharing on MacOS so the Pi can connect to it. Go to System Settings > Sharing:

3. Configure SSH access

This assumes that you have an ssh key. If not or you don’t know what that is: An ssh key consist of two files: A private and a public one. The private one (id_rsa) is on your computer and works like a password (so do not share it!). The public one ( is on other computers and identifies you. It only works together with your private key, so don’t loose it. Your public key is on your computer as well so you can easily share it.

You can find both keys with

$ ls -l ~/.ssh
total 120
-rw-------  1 jannikarndt  staff  1766 Jan  3  2017 id_rsa
-rw-r--r--@ 1 jannikarndt  staff   403 Jan  3  2017

If you don’t have a key, GitHub has a great article on how to create one.

  1. Copy your ssh key to the pi:

    cat ~/.ssh/ | ssh pi@raspberrypi.local "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
  2. SSH into the pi:

    ssh pi@
    pi@'s password: raspberry

    The preconfigured password is raspberry. A good reason to change it right away:

  3. Change your root password:

    sudo raspi-config

  4. Add your wifi credentials in 2 Network Options > N2 Wi-fi

  5. Permanently enable ssh access in 5 Interfacing Options > P2 SSH.

4. Install oh-my-zsh

And now, for the grand finale, you can (should / will want to) install a proper shell, i.e. oh my zsh:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git zsh
chsh -s /bin/zsh
sh -c "$(curl -fsSL"

5. Continue

Great! Now you can use your Pi, for example


While the Akka documentation is incredibly well written, it has surprisingly few images. Since I visualize concepts to remember them, here is my take on how Event Sourcing in Akka Persistence works:

Changing the password for a PostgreSQL database user involves two steps: The change in the database and the change in the application code. This blog post describes how to do this without any downtime or failed authentication tries.

The PostgreSQL installation comes with a great tool, psql, to administer and inspect the database. pgcli extends this with syntax highlighting and autocompletion.