Flashing Raspberry Pi OS (formerly Raspbian) to an SD card is simple. Here’s how to do it on Windows, macOS, and Linux:
1. What You Need
- A microSD card (8GB+ recommended, Class 10/UHS-I for best performance).
- A microSD card reader (if your laptop doesn’t have one).
- Raspberry Pi Imager (official tool) or BalenaEtcher (alternative).
- Raspberry Pi OS image (download from raspberrypi.com/software).
2. Step-by-Step Instructions
Method 1: Using Raspberry Pi Imager (Easiest)
- Download Raspberry Pi Imager
- Windows/macOS/Linux
- Install and open it.
- Choose the OS
Click "Choose OS" → Select "Raspberry Pi OS" (or another version like Lite for headless).
- Select the SD Card
- Insert the SD card into your computer.
- Click "Choose Storage" → Pick your SD card.
- Flash the OS
- Click "Write" → Confirm (this will erase the SD card!).
- Wait (~5-15 mins, depending on speed).
- Eject Safely & Boot
Remove the SD card, insert it into your Pi, and power it on.
Method 2: Manual Flashing (Advanced)
On Windows (Using BalenaEtcher)
- Download Raspberry Pi OS (.img.xz file) from raspberrypi.com.
- Install BalenaEtcher.
- Open Etcher → Select Image → Choose SD Card → Flash!
On macOS/Linux (Using dd Command)
- Find your SD card (check with diskutil list on macOS or lsblk on Linux).
Example: /dev/disk2 (macOS) or /dev/sdb (Linux).
- Unmount the SD card (but don’t eject it):
bash
diskutil unmountDisk /dev/disk2 # macOS
sudo umount /dev/sdb* # Linux
- Flash using dd (replace /dev/disk2 with your SD card):
bash
sudo dd bs=4M if=~/Downloads/raspios.img of=/dev/disk2 conv=fsync status=progress
- Eject safely and boot the Pi.
3. Post-Flash Setup (Optional)
Enable SSH (Headless Setup):
Before booting, create an empty file named ssh in the SD card’s boot partition.
Configure Wi-Fi (Headless):
Create a wpa_supplicant.conf file in boot with your Wi-Fi details:
plaintext
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=US
network={
ssid="YourWiFi"
psk="YourPassword"
}
4. Troubleshooting
SD Card Not Detected?
Try a different USB reader or port.
Pi Won’t Boot?
- Reflash the SD card (may be corrupted).
- Try a different SD card (some cheap ones fail).
Slow Performance?
Use a UHS-I/U3 card for better speed.
Done!
Your SD card is ready. Plug it into your Pi, power it on, and follow the setup wizard.