How to setup a Raspberry Pi & WiFi without a monitor (Headless) using a Macbook

In this article, I’m going to share my experince of setting up a Raspberry Pi headless (without a monitor) using a Macbook.

In this 3 step tutorial, we will go through how to prepare your Raspberry Pi, setting it up through a wired connection and finally setting up the WiFi connection.

Things you will need:

  1. Raspberry Pi
  2. USB WiFi Adapter
  3. Micro SD Card
  4. Micro USB Cable
  5. Ethernet Cable

Software to download

  • Raspbian Operating System
  • Pifiller

Assumptions

  • You have a Wifi router with Ethernet ports
  • You have basic working knowledge of Linux (Debian).

Step 1 – Preparation

Open PiFiller and it will ask you to select the OS image. Choose the .img file.
When prompted, insert the SD card (using an adaptor) and proceed.
The content of the card (if any) would be erased the Raspiban files would be copied.
After trying out a couple of different ways to do this, I can now vouch that PiFiller is the best way to install Raspiban OS on a SD card.

Step 2 – Booting the PI and accessing it via SSHRaspberry Pi connected to ethernet and power

Insert the SD Card into the slot
Plug in the Ethernet Cable and connect it to the Router
Power up using the Pi

Before you can access your Raspberry Pi, you need its IP address. Below are the steps to get the IP address of your Raspberry PI and log in via SSH

  1. Log in into your router and check out what IP addresses it is giving out. Mine gives out IP addresses starting from 192.168.0.100. You will find this under DHCP settings of your router.
  2. Open up a terminal window and type nmap -sn 192.168.0.100/24
  3. From the list you should be able to identify the IP address that corresponds to your RaspberryPi
  4. type ssh pi@{raspberry_pi_ip_address}
  5. When prompted for password, enter ‘raspberry’

Your screen should look something like this. I’ve highlighted the commands you will be running.

[email protected]:~$ ssh [email protected]

The authenticity of host ‘192.168.0.107 (192.168.0.107)’ can’t be established.
ECDSA key fingerprint is fc:13:a8:50:4d:ae:d8:7c:6d:3c:0b:3b:b1:58:d8:25.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.0.107’ (ECDSA) to the list of known hosts.
[email protected]’s password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Oct 30 05:17:06 2015
[email protected] ~ $

login

Step 3 – Setting Up Wifi

If you have completed step 2, then you are logged into your Raspberry Pi. Now plug in your USB dongle run the following command.

[email protected] / $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

There may be a couple of lines in that file. Add the following

network={
ssid=”Your WiFi Connections’ Name”
psk=”Your WiFi Password”
}

Save the file. Now run the command ifconfig. If everything is okay, you should see the IP address assinged to your Raspberry Pi under wlan0.

Raspberry Pi ip addres of Wifi adapter

That’s it. Restart your Raspberry Pi and remove the ethernet cable. Before you begin exploring, don’t forget to run apt-get update and apt-get upgrade.