Bootstrap your Raspberry Pi
Install Raspbian on a SD card
Mount the SD card on your computer
Put an empty file named ssh
in the boot partition to enable ssh.
sudo touch /Volumes/boot/ssh
Mount the SD card on your computer
Open file for edit named config.txt
in the boot partition.
vim /Volumes/boot/config.txt
Enable serial console (optional)
Add or edit the following line enable_uart=1
On Raspberry Pi 3 also add dtoverlay=pi3-disable-bt
Adjust gpu memory (optional)
Add or edit the following line gpu_mem=16
The minimum value is 16.
The maximum value is 192, 448, or 944, depending on whether you are using a 256MB, 512MB, or 1024+MB Pi.
Put the SD card into the Raspberry Pi and boot the device.
Log in with the default credentials (pi/raspberry).
Setup Passwordless SSH access
Copy your public key to the Raspberry Pi authorized_keys
file
ssh-copy-id pi@raspberrypi.local
Add or edit the following line in /etc/ssh/sshd_config
PasswordAuthentication no
Change raspberrypi to your desired hostname in /etc/hostname
and /etc/hosts
NEW_HOSTNAME=new-hostname
sudo sed -i " s/raspberrypi/$NEW_HOSTNAME /g" /etc/hostname
sudo sed -i " s/raspberrypi/$NEW_HOST /g" /etc/hosts