I had a previous Raspberry Pi B original back in Australia and used it primarily as an Apple TV alternative and torrent server (legal torrents only of course). And although it was pretty cool to have, I didn’t end up doing too much with it. But after having a semester studying Physical Computing (@ NYU) and learning all about Arduino, I have a whole new motivation to get started.

Reading through the internet I realized that there are plenty of guides that show you setup a Raspberry Pi using ethernet, or setting them up with a keyboard and monitor. However as the new Raspberry Pi Zero has no ethernet port, and I don’t have a keyboard or monitor (Macbook only kinda guy) I decided to put together a guide (advanced) for a wireless headless setup (without monitor) on a Mac (OS X).

Purpose:

To setup, a Raspberry Pi without a monitor, keyboard or mousing, using only a wifi dongle.

Material:
  • Raspberry Pi (B or Zero)
  • USB Wifi Dongle
  • Raspbian Image
  • Micro SD Card
Method:

I started off by downloading a Rasbian Image (Jessie) from the official [RaspberryPi site].

Next, I got a 16gb micro SD card and formatted in fat32.
Then using the command line instructions on the Raspberry Pi I imaged the SD card.

Using Command Line
- insert USB, open terminal, and run
diskutil list
this will let you see which disk, should be something like this:
/dev/disk2

- unmount disk   
`diskutil unmountDisk /dev/disk2`  

- copy data to SD card   
`sudo dd bs=1m if=~/Downloads/2015-11-21-raspbian-jessie.img of=/dev/disk2`  

While this is copying to the micro sd card, you can type Ctrl-t at and time and it will update you with the number of bytes copied. Using a macbook pro and a class 10 sd card it took around 6-8mins.

Now is where it starts to get a little bit difficult, if you are running Linux, or have access to a Linux machine (even a virtual machine) I highly recommend using that, and you should be able to mount EXT4 no troubles.

However OS X is not able to natively do so. As such I downloaded a program called OSXFuse that allows you to mount Extended File Systems. For more information see the OSXDaily article. Next you need to install Fuse Ext2, this is reasonably heavily involved, and you need to disable crsutil.

Once this was all installed I then ran the following command to mount the Ex Format SD Card
sudo fuse-ext2 -o force /dev/disk2s2 /Volumes/

After this I needed to modify the SD setting on the SD Card so that it knows our Wifi Network and SSID. There is more information about setting up the Wifi on the Raspberry Pi via command line here.

The file is located here:
/etc/network/interfaces

auto lo  
iface lo inet loopback  
iface eth0 inet dhcp  

allow-hotplug wlan0  
auto wlan0  

iface wlan0 inet dhcp  
   wpa-ssid "Your Network SSID"  
   wpa-psk "Your Password"

After this, you should be all set. Plug in the Mico SD Card, and boot up the RPi, and it should auto connect to your wifi. You may use a utility like [Fing] to scan your local network for the RPi IP address, or use the your routers admin panel to see the connected device.

Once you have the IP address you can simply SSH in to the RPi
ssh [email protected]
using your IP address, with the password raspberry. And now you have a fully functional RPi.

To save future pain I went and cloned the Raspberry Pi image for a simpler setup next time.

Update: 26 Jan 15
If you think that you will only need to mount the ext4 on your system once, it maybe easier to use a program/drive called Paragon Software EXTFS-Mac they have a 10day trial which is enough to get you started, or alternatively you can run Ubuntu in a VM.

Update: 1 Jan 16
There is a great bit of software called PiBakery which simplifies adding the wifi network.

Ref:
Keywords:

Raspberry Pi, Zero, Arduino, Setup, Guide