A complete guide to setting up a Raspberry Pi 3 (RPi) to connect wirelessly. Everything is setup from your laptop, writing to a micro SD card before plugging the card in to the RPi. I'm doing this on an Ubuntu computer. I imagine it is very similar from a Mac.

  1. Download and unzip the Raspbian Lite operating system (OS). You will now have an img file ready to write somewhere.
  2. Download, install and run Etcher to write the raw operating system to the SD card. This is by far the easiest / safest way to write the OS to the card. (Note I have no liability for mistakes that may occur with this. Follow the instructions on Etcher's website)
  3. Open a command window and enter:
    sudo touch /media/xyz/boot/ssh

    where xyz is the path to the SD card and main_drive_abc will be some long text. One of these two is not necessary but I don't care which. This writes an empty file to these folders. They enable ssh so the RPi can be connected to using the SSH protocol from your laptop.

  4. Now to use WiFi you'll need to give the RPi your username and password. This command will open an editor on the file that stores this information:
    sudo nano /media/xyz/main_drive_abc/etc/wpa_supplicant/wpa_supplicant.conf

    At the bottom of the file add this:

    network={
        ssid="wifi_name"
        psk="wifi_password"
    }

    Now press Ctrl+X to exit. Press "y" to save it as the correct filename.

  5. Put the SD card in the RPi. Plug in the USB power cable. You are ready to connect from your laptop.
  6. Find the RPi on your network using the command
    sudo arp-scan --localnet
    Hopefully there will be an obvious choice. If not, try the following instruction changing the final number in the IP address below with each choice you see in arp-scan's output
  7. Connect to the RPi with the command (changing 192.168.0.18 for whatever number your RPi is allocated on your network)
    ssh pi@192.168.0.18

    The username you are using is pi. The password when prompted is "raspberry"

  8. It is a huge security whole leaving the password unchanged. Run
    sudo raspi-config

    This gives you an interactive menu. Change the password, update the system. You now have an operational Raspberry Pi to hack.