How to set up your headless Raspberry pi 4 (for MasOS)
It is pretty clumsy to connect monitor, mouse and keyboard for just setting up raspberrypi. Here is the way to avoid it.
Set up Raspberry OS, wifi and ssh support
- Download Raspberry Pi Imager
2. Run Raspberry Pi Imager
3. Select the followings, and then click WRITE
- Operating System: Raspberrypi OS
- SD Card: <your SD card storing your OS>
You may need to wait for more than 20 mins
4. Turn on your terminal, type the followings:
$ df -h
Find out which file system is your SD card, go to that partition, say
$ cd /dev/disk1s1
5. Go to
6. Modify the script
headless-pi.sh below with your
psk . Run the script in
The script will create two files —
wpa_supplicant.conf. It will enable your pi ssh and wifi connection.
Now you can put your SD card to raspberry pi and run it.
Connecting to raspberry pi through SSH
You can use
ssh directly, but I would prefer
sshpass that can store my password.
$ brew install hudochenkov/sshpass/sshpass
2. Download and run the script
3. You can now access your raspberrypi!