Notes on setting up a raspberry-pi from a bare image

Reading time: about 1 minute

Acquire an image

Burn the .img

On macOS.

Find the dev node for the disk:

# find disk
diskutil list

# unmount disk (eg disk3)
diskutil unmountDisk /dev/rdisk3

# copy image on disk3
sudo dd bs=1m if=~/Downloads/raspbian-stretch-lite-2019-04-08-hkcam-v0.0.8-armv6.img of=/dev/rdisk3 conv=sync

Pre-first-boot modifications:

A bunch of stuff can be enabled or disabled by dropping magic files into the boot partition which save a bunch of time.

WiFi Config

On the SD card, before booting it for the first time:

Create a file on the boot partition called wpa_supplicant.conf with these contents:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Enable SSH

On the SD card, before booting it for the first time:

Touch a file called ssh in the boot folder, this will configure the system to allow ssh.

Enable the camera

sudo raspi-config nonint do_camera 0

Disable the camera LED

First up, we need to edit the config file.

sudo nano /boot/config.txt

Add the following line to the end of the file, then save it.


Date: 2019-Jun-09
Tags: bash raspberry-pi diskutil wpa_supplicant ssh
Previous: Notes on installing HKCam on a raspberry-pi with systemd
Next: keeping your secrets hidden