For those of you that aren't quite sure of the difference between an Arduino and a Raspberry Pi, this is a pretty good summary.

The Raspberry Pi website has a good break down of the different Pi models that are available.

It's important to note that his setup guide is for the JESSIE LITE raspbian distribution. The instructions for connecting to the Pi remotely are for Mac OSX only.
If you want to set up your Pi for an application that requires a screen and has a desktop operating system, you can download the easy-to-use NOOBS OS Installer (You can follow Step 1 to copy the image to your SD card).

What you'll need:

  • A RaspberryPi
  • A laptop/computer with an SD card reader
  • An microSD card ( 8GB, class 6 ) is recommended. *The class refers to the read/write speed of the card.
  • USB cable (check your pi for the size)
  • A screen with an HDMI port
  • An HDMI cable
  • A USB keyboard
  • An ethernet cable
  • An ethernet adapter if you don't have an ethernet port

Step 1: Downloading and installing the OS

Your Pi is small computer, and all computers need an operating system (OS) to be of any use, so let's install one. The first thing you need to do is format the SD card.

  • Download the SD Association's Formatting Tool from
  • Install and run the Formatting Tool on your machine
  • Select "Overwrite Format"
  • Give the disk a name that'll be easy to identify ( I just called mine 'Pi' ).
  • Check that the SD card you inserted matches the one selected by the Tool
  • Click the "Format" button (Be patient, this can take a while if you have a large card).

We're going to be installing the RASPBIAN JESSIE LITE (this is the command line only operating system). Feel free to install any of the other OSs, but this guide will be covering the JESSIE LITE only.

Now we're going to be be writing the disk image, that you've just downloaded, onto the microSD card using the command line.

  • Extract the file.
  • Drag the raspbian-jessie-lite.dmg file into/onto your desktop.
  • Open up Terminal. With the SD card still inserted in your laptop/computer, type the following command into your terminal window:
diskutil list
  • You should see something like this:
  • ![Terminal](images/terminal.jpg)
  • The easiest way to identify which disk is your SD card is to look for the name you gave it during formatting. You should also recognise it based on its size ( mine's a 16GB card ).
  • You can see clearly that mine is /dev/disk2.
  • unmount you card by typing the following command (you'll be substituting disk2 for whatever you identified your SD card to be):
    diskutil unmountDisk /dev/disk2
  • Now we're going to copy the disk image to the SD card. In terminal, navigate to your desktop folder (you can do this by typing
    followed by a space, then drag the desktop folder from your finder window into terminal. You'll see the command line populate with your desktop folder's path. Press Enter.
  • Type in
    ls -l
    and hit Enter. You should see a list of all the files and folders on your desktop. Scroll up and copy the name of your disk OS disk image by highlighting it with your cursor and using the keyboard shortcut cmd+C
  • Now type in the following command (remember to replace the img name, and the disk name, that are in bold with those of your own image and disk):
    sudo dd bs=1m if=2015-11-21-raspbian-jessie-lite.img of=/dev/rdisk4
  • Hit Enter. And you should be prompted to enter your password. If it was successful, the cursor will just be flashing on a blank line. You can check that there is copying taking place by hitting the Ctrl+T keyboard shortcut.
  • Eject the disk (Using Disk Utility or in Finder) and place it in your RaspberryPi.


If you encounter the error:

dd: invalid number '1m'

try replacing the '1m' in the previous command with '1M'

sudo dd bs=1M if=2015-11-21-raspbian-jessie-lite.img of=/dev/rdisk4

(remembering to subsitute the img name and disk for your own).

If it still doesn't work, consult the 

Step 2: Setting up a new user

Plug in your USB keyboard and HDMI cable before powering up your Pi with the USB cable.

Once the boot sequence has completed, you'll be asked to login. Enter the default username:


followed by the default password:


Setting up a new user is recommended and more secure, but not necessary, so feel free to skip to Step 3 if you're happy with the defaults provided.

To create new user, type the following command (replacing the name in bold with the name you choose).

sudo adduser craig

you'll be prompted to enter a password of your choosing. Once selecting your password you'll be prompted to fill in the user's details such as name, number etc.. feel free to leave those blank by just hitting Enter.

Before switching to your new user, we need to five it sudo privilages. The default pi user on Raspbian is a sudoer. This gives the ability to run commands as root when preceded by sudo, and to switch to the root user with sudo su.

To give your new user sudo privilages, type the following command:sudo visudo

This will open the /etc/sudoers file. Search for the line that says:


and add the following line under it (remembering to substitute your own username for the one in bold)


To exit the document, use the keyboard shortcut Ctrl+X, then hit 'Y', then hit Enter.

To switch to your user, type the following command (substituting in your own username):

su craig

Step 3: Setting up the Pi's network interface

We'll be connecting directly to the Pi using an Ethernet cable. To do this, we need to set a static IP on the eth0 port. We do this by editing the dhcp config file. To open the file, type in the following command:

sudo nano /etc/dhcpcd.conf

'nano' is simply the default text editor, so the above command is saying that we want to open the config file using the nano text editor.

Add the following lines to the bottom of the document:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

To save the document, use the keyboard shortcut Ctrl+X, followed by 'y', followed by enter.

Plug the ethernet cable into your laptop and the Pi.

Now we need to reboot the network interface. Do this using the following command:

sudo ifdown eth0 && sudo ifup eth0

To check that everything is working, type the following command:


Your results should look something like this:

eth0Link encap:EthernetHWaddr b8:27:eb:cb:6f:43
inet addr:
inet6 addr: fe80::6e9b:57b0:2d93:2c09/64 Scope:Link
RX packets:330 errors:0 dropped:0 overruns:0 frame:0
TX packets:282 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:45307 (44.2 KiB)TX bytes:37909 (37.0 KiB)

Take note of the inet addr and Mask, we'll be using these to set the network interface for your laptop.

Go to your System Preferences > Network

You'll want to locate your ethernet port, or the adapter port, from the list provided. In the dropdown menu next to 'Configure IPv4' select manually

Fill in the fields according to the image below, ensuring that the subnet mask is the same ifconfig's Mask on your Pi. The IP address should be the same as your Pi, except for the last digit which can be anything between 0-99, as long as it is not the same as your Pi's or the Router.

Click Apply and open up Terminal again.

To test that the connection is working, type in the following (provided you set your Pi's IP address to the same as mine):


If the connection has succesfully been established, you should see results like this (use the keyboard shortcut Ctrl+C to stop pinging your Pi):

172-16-216-16:~ Craig$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.542 ms
64 bytes from icmp_seq=1 ttl=64 time=0.339 ms
64 bytes from icmp_seq=2 ttl=64 time=0.384 ms
64 bytes from icmp_seq=3 ttl=64 time=0.409 ms
64 bytes from icmp_seq=4 ttl=64 time=0.409 ms
64 bytes from icmp_seq=5 ttl=64 time=0.350 ms
64 bytes from icmp_seq=6 ttl=64 time=0.291 ms
--- ping statistics ---
7 packets transmitted, 7 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.291/0.389/0.542/0.074 ms

Step 4: Connecting to your Pi

From this point onwards, you no longer need a screen and keyboard to access your Pi.

Secure Shell (SSH)is a command interface and protocol for securely getting access to a remote computer. We'll be using SSH to transfer files and access the Pi remotely. This means that you can now access the Pi without needing a screen or keyboard.

To SSH into your Pi, type the following command:

sudo ssh your_pi_username@your_pi_IPaddress
eg. sudo ssh craig@

If asked about RSA key authentication, simply type 'yes'

You should now be logged into you Pi.

Let's test the connection by copying across a file using SCP (secure copy protocol).

Open up a new terminal window, you can create a new tab in your existing terminal using Cmd+T (keep the terminal window that you SSH'd into you Pi open).

Create a new file that you'll be copying over. To create a test text file, type the following command:

echo this is some sample text >> test.txt

This should have created a text file called test.txt in your present working directory. To check if it's there, type the following command:

ls -l

You should see the test.txt file in the list of files, like the one below:

172-16-216-16:Desktop Craig$ ls -l
total 3389224
-rw-r--r--@1 Craigstaff1458569216 Nov 21 21:32 2015-11-21-raspbian-jessie-lite.img
-rw-r-----@1 Craigstaff 13712 Jan9 14:29 CXvbW1lWcAAl5z_.jpg
-rw-r--r-- 1 Craigstaff 276026159 Dec9 17:59
-rw-r-----@1 Craigstaff 22689 Jan2 23:31 Twitter_logo_blue.png
drwxr-xr-x 3 Craigstaff 102 Apr 252015 basic_depth
-rw-r-----@1 Craigstaff6129 Dec 14 12:12 castle.png
drwxr-xr-x32 Craigstaff1088 Dec 15 00:12 demo
-rw-r--r--@1 Craigstaff 74334 Dec7 16:24 schematic.png
-rw-r--r-- 1 Craigstaff20 Jan 22 11:51 test.txt
-rw-r--r-- 1 Craigstaff430629 Jan2 21:03 three.min.js
-rw-r-----@1 Craigstaff 91807 Jan6 16:52 tumblr_nuzyppVxQN1uqyj3lo1_1280.png
-rw------- 1 Craigstaff 22130 Nov 16 19:31
172-16-216-16:Desktop Craig$ 

You need to know the path of where you want to copy your file to, switch tabs back to the window that's logged into your Pi and type:


This will give you the present working directory for your Pi, which'll look something like this:

craig@raspberrypi:~ $ pwd

Switch back to the window and repeat the previous step. My path looks like this:

Craigs-MacBook-Pro:Desktop Craig$ pwd

Now that we have both the source and destination paths, we can perform the copy. To perform the copy, type the following command (substituting my file paths for your own):

scp /path/to/file username@a:/path/to/destination
eg. scp /Users/Craig/Desktop/test.txt craig@

Enter the password for your Pi's username when prompted to do so! If the copy is successful, you'll see a message like this in the console:

Craigs-MacBook-Pro:Desktop Craig$ scp /Users/Craig/Desktop/test.txt craig@
craig@'s password: 
test.txt100% 20 0.0KB/s 00:00 

To double check, switch to your Pi's terminal window and type the following command:

ls -la

You can see from my console that the file copied successfully!

craig@raspberrypi:~ $ ls -la
total 28
drwxr-xr-x 2 craig craig 4096 Nov 22 03:24 .
drwxr-xr-x 4 rootroot4096 Nov 21 22:03 ..
-rw------- 1 craig craig589 Nov 22 02:05 .bash_history
-rw-r--r-- 1 craig craig220 Nov 21 22:03 .bash_logout
-rw-r--r-- 1 craig craig 3512 Nov 21 22:03 .bashrc
-rw-r--r-- 1 craig craig675 Nov 21 22:03 .profile
-rw-r--r-- 1 craig craig 20 Nov 22 03:24 test.txt

Some useful commandline commands for the Pi

Create a text file

nano your_file_name.extension
eg. nano

Create a directory

mkdir your_directory_name

Delete a file:

sudo rm file_to_delete.extension

Delete a folder and all its contents:

sudo rm -rf folder_to_delete

Shutdown your Pi:

sudo shutdown now

Restart your Pi:

sudo shutdown -r now

Stop any and all scripts running in the background

sudo killall