Interlock is a non-profit organization that provides space for its members and the local community to develop and share their interests in science, technology, art, and culture.

Raspberry Pi-ing, MacGyver Style

Ok, so there’s no duct tape, toothpicks, or bubble gum involved, but I thought it’d be helpful to document a handy way to tinker with your Raspberry Pi, even when you’re almost completely lacking in the required external paraphernalia.

Raspberry Pi Workshop

We recently had Rob Bishop from the Raspberry Pi foundation stop by Interlock and give a workshop for a couple of hours, and as we scrambled to prepare — attempting to pull together 20 hdmi monitors, 20 usb keyboards, 20 power supplies, et cetera — I kept thinking that it’d be nice to be able to play around with a Pi even if you’ve arrived unprepared for such an event. So what follows is “how to fiddle with the Pi GUI with just your laptop, an ethernet cable, and a micro USB cable”. We’re going to start with a freshly imaged SD card, hook it up to a Mac or Ubuntu laptop through their internet sharing capabilities, and use VNC to share the GUI over the network.


Getting Started

The first step we’ll gloss over is copying a fresh Raspbian image onto an SD card. This is covered in great detail at the embedded Linux wiki, where they have plenty of information on setting up the Raspberry Pi. Go there, follow along, and insert your newly imaged card into your Pi.

Internet Sharing

Next, we’re going to prep our laptop to share its internet connection with the Pi. I know nothing about Windows, but on Ubuntu and Mac OSX, there are easy ways to share your wifi connection with any computers that are hooked up to your ethernet port. We’ll take these one OS at a time:

Screen shot 2012-12-05 at 4.25.15 PM

Assuming your Mac is connected to a wireless access point, open up the “Sharing” control panel in System Preferences. Click on the “Internet Sharing” option, which is probably grayed out at this point. Choose “Ethernet” as the port you’ll share your internet connection out of, and then turn on Internet Sharing by clicking its checkbox, which should now be clickable. Done.

Screenshot - 12052012 - 07:15:23 PM

This step is equally easy on Ubuntu (and its variants… I use Xubuntu). Open up the “Network Connections” system preferences. You’ll see something like the above screenshot. Click the big “+ Add” button.

Screenshot - 12052012 - 07:16:31 PM

You’ll be confronted with something like the above. Name this new connection something logical. “Connection Sharing” works for my brain. Click over to the “IPv4” tab and select “Shared to other computers” from the “method” dropdown. Some people have reported problems with IPv6 at this point, so click over to that tab and select “Ignore” in the same dropdown. Save the connection. Carry on.

Plugging In

Now we should be back on the same page for both OSes. Find the shortest ethernet cable you can and plug your Pi into your laptop’s ethernet port. Nothing should happen. Plug the USB cable into your laptop, and then into the micro USB port on the Pi. Before doing so, reflect upon the fact that the Pi foundation does not recommend you power your Pi off of a computer’s USB port. Your computer might not be able to supply enough power, and/or might burst into flames. I’ve not had any such problems, but if your Pi is acting flaky, or if you’re planning on plugging any USB peripherals into the Pi, you may want to sacrifice MacGyver points and portability in favor of a wall outlet.

Sleuthing IPs

Ok. We’re plugged in with internet tubes and power. Your Pi should be booting up and making happy blinkies on its status LEDs. After a short while, it’s safe to assume that it has fully booted and grabbed an IP address from your laptop. Hooray! Open up a terminal and perform the following incantations to find out what address it was assigned.

Screen shot 2012-12-05 at 6.12.15 PM

On the Mac, cat /private/var/db/dhcpd_leases should pop up a block of text with the desired info. Above, we got an address of That’s probably pretty standard.

Screenshot - 12052012 - 07:23:02 PM

On Ubuntu Linux, cat /var/lib/misc/dnsmasq.leases will get you the same info. In this case, our IP is

SSH, and Setting Up a VNC Server

Just a few more steps. We need to SSH into the Pi. That is, we need to connect to a command shell on the Pi so we can install a few things to get our display up and running.

ssh pi@x.x.x.x

Substitute the IP you found previously for all the x.x.x.x mayhem at the end there. It should connect and ask you for the default password, which is “raspberry”. Now install the vnc server. This is what will transmit the desktop environment to your laptop:

apt-get install tightvncserver

Run the VNC server once, and it will ask you to set a password:


Set and remember a password when it prompts you. I just used “raspberry” again. I’m creative like that. Now we’ll run the VNC server for real:

vncserver :1

The “:1” is the display number. This is necessary because you could serve multiple virtual displays off of one computer. But lets not get ahead of ourselves.

Installing a VNC Client

We’re now ready to install the VNC client on our laptop and connect to the Pi’s GUI. Chicken of the VNC is a popular Mac client. Download and install that as per normal. On Ubuntu, Vinagre is probably the most popular client. apt-get install vinagre should get it installed without a problem.

Screen shot 2012-12-05 at 4.52.36 PM

Almost there. Above is the Chicken of the VNC connection dialog. Fill in the IP address you found previously, and the “1” display number and password. Click connect and you should be up and running! On Ubuntu, the command vinagre x.x.x.x:1 will do the same thing. Yay! You’re done. Celebrate your hard work and dedication while admiring your glorious accomplishment:


Extra Credit

Fellow Interlock member BleuLlama suggested a way to make this process a bit easier the second time around. Rather than hunting down the Pi’s IP address (which is admittedly not very difficult to do), we can use Apple’s Bonjour protocol (aka ZeroConf) to have the Pi announce itself to the network. I found a good writeup on how to do this, plus how to get the VNC server to start automatically on boot. Check it out at Pat Galea’s blog. You can ignore the part about installing Netatalk unless you care about Mac file sharing.

When you’re done with your extra credit, you’ll have a Pi that you can plug into your ethernet and USB ports, wait a minute or two, and it’ll pop up automatically in Chicken of the VNC or Vinagre (or any Bonjour enabled VNC client, of course).

from on December 6th, 2012Comments20 Comments

20 Comments on “Raspberry Pi-ing, MacGyver Style”

  1. 1 Charles G. said at 11:54 pm on December 10th, 2012:

    Thanks for Article.
    — i cheat and don’t use laptops power supply tho~~.

  2. 2 Raspberry Pi Hacking, Commando Style said at 9:02 am on December 12th, 2012:

    […] useful equipment for your Raspberry Pi hacking adventure, such as an HDMI monitor or power supply, this handy write-up will show you how to continue your hacking. All you’ll need is a laptop, the Raspberry Pi […]

  3. 3 Infidellic said at 9:17 am on December 12th, 2012:

    Ok so you’ve got a SSH console connection why bother with a full GUI and VNC (which is truly terrible IMO – waaaay too laggy and low def) when you could simply X11 forward?

  4. 4 trouch said at 9:28 am on December 12th, 2012:

    MacGyver does it only with SSH 😛

  5. 5 Indagadores |Seguridad informatica |Seguridad en internet » Raspberry Pi Hacking, tipo comando said at 9:38 am on December 12th, 2012:

    […] para tu Raspberry Pi aventura hacking, como por ejemplo un monitor HDMI o fuente de alimentación, este práctico escribir-up le mostrará cómo continuar su hacking. Todo lo que necesitas es un ordenador portátil, el […]

  6. 6 teaborne said at 5:20 pm on December 12th, 2012:

    When you connect the Pi to the Mac, do you use a crossover network cable?

    When I tried it, I couldn’t get the internet sharing to work.

  7. 7 Berticus said at 5:24 pm on December 12th, 2012:

    @teaborne: You shouldn’t need a crossover cable. The Pi should sort it out automatically (your mac probably does too, unless it’s super old).

    I successfully used a plain cable on both my Mac (an old Mini) and my Lenovo laptop.

  8. 8 Berticus said at 5:27 pm on December 12th, 2012:

    @Infidellic: when I was doing this, I was mostly thinking about people at Pi workshops and such, where you have beginners all booting up into the default desktop experience in order to follow along.

    You wouldn’t get that with X11 forwarding.

  9. 9 Raspberry Pi-ing, MacGyver Style #piday #raspberrypi @Raspberry_Pi « adafruit industries blog said at 1:07 pm on December 14th, 2012:

    […] Helpful post about how to prep your RasPi for access for when you don’t have the outboard monitor/keyboard/mouse to work with, via Interlock Rochester: […]

  10. 10 Lennart said at 7:43 pm on December 30th, 2012:

    Yet another way is to give the Raspberry Pi a static IP-addr.
    Reinsert the SD-card after the image is loaded and locate the file /etc/network/interfaces and edit it (my example below). Then move SD-card to the RB-Pi and power up and connect to the given address.

    Change line:
    iface eth0 inet dhcp

    To lines:
    auto eth0
    iface eth0 inet static

  11. 11 Nicolò Paternoster said at 10:48 am on January 4th, 2013:

    Thanks! I used your guide to connect with the 3G and I wrote a small tutorial :

  12. 12 Mahrud Sayrafi: Android Lockdown, or How to Find the Inner Linux! | Fedora Linux said at 11:47 pm on January 20th, 2013:

    […] more information refer to `iptables` and `ip` manual pages. I found this link 5 to be very informative, even though the purpose is different and it’s mainly graphical, it’s […]

  13. 13 Elliott Hauser - since 1983 said at 12:17 pm on February 16th, 2013:

    […] Getting VNC running on Mac OSX or Linux to use your Pi with your existing computer (thanks to a nice tutorial from Interloc Rochester) […]

  14. 14 Travis said at 8:37 pm on February 9th, 2014:

    I can ssh into my pi but my pi can’t connect to internet.

    I’m running ubuntu 12.04
    I can ping sites like google but it won’t let me acess the web

  15. 15 Connectez vous à votre Raspberry Pi sans internet avec ethernet ! said at 12:36 pm on April 25th, 2014:

    […] article et la traduction de l’article d’Interlockroc qui m’a sauvé la vie […]

  16. 16 pankaj said at 2:58 pm on May 17th, 2014:

    after typing: pi@raspberrypi ~ $ “vinagre”
    it shows
    (vinagre:3818): Gtk-WARNING **: cannot open display:

    what might be the problem ?
    my OS is “ubuntu 14.04”

  17. 17 Andrew said at 4:03 pm on October 10th, 2014:


    I’ve spent hours trying to get this to work before, following long tutorials that lead to nothing. I still can’t believe it’s so easy.

  18. 18 SSH to RPi without a network connection? | CL-UAT said at 4:25 pm on December 27th, 2014:

    […] If you’re using Mac or Ubuntu/Debian there’s an excellent explanation of doing exactly this called Raspberry Pi-ing, MacGyver Style. […]

  19. 19 SSH to RPi without a network connection? | DL-UAT said at 10:26 am on February 3rd, 2015:

    […] If you’re using Mac or Ubuntu/Debian there’s an excellent explanation of doing exactly this called Raspberry Pi-ing, MacGyver Style. […]

  20. 20 Akash said at 1:06 am on November 19th, 2015:

    You sir are a god.
    Got it working now

Leave a Reply

  • Please complete the equation below before submitting. * Time limit is exhausted. Please reload CAPTCHA.