Use Your Mac Laptop as a Wireless Proxy for Raspberry Pi

Use Your Mac Laptop as a Wireless Proxy for Raspberry Pi

I got my Raspberry Pi this week, and I have to say that despite the wait (or maybe because of it), the whole user experience of getting this running was exciting. I was reminded of when my Dad brought home our first “Fat Mac” in 1985 (Fat because it had 512k of RAM). Actually, this was a better experience; when we got the Mac home from Computerland we found it had a bad mouse controller and we had to wait until Monday to bring it back. Getting the big Raspberry Pi logo up on the TV felt a little like seeing the Happy Mac for the first time, even though I didn’t have to do anything other than format an SD card.

One of the first things I realized was that the need for a wired Ethernet connection is kind of a hurdle; it goes against the way that most of us get online these days. I only have two wired connections in my house now, in inconvenient locations where our desktop computers used to be years ago. When I’m in the studio out back I’m always connecting via Wifi with my Mac; I thought one of the first things I’d do would be to set the Mac up as a proxy server for the Pi.

A quick aside on peripherals and the Raspberry Pi: I could see how these could add up really quickly. I have an extra DVI monitor so I got a HDMI to DVI cable, and you definitely need a proper micro USB supply (at least 1 amp; your phone charger won’t cut it). Online these are cheap enough; expect to spend at least another $15 to $20, or much more if you try to get these items in retail stores. A $30 Wifi dongle might work, but from reading the forums it seems that the USB ports are a bit under spec and should probably not be thought of as equivalent to a standard computer USB port. Thus, my decision to go with a software proxy solution.

Read on for all the steps for configuring a proxy server on the Mac for your Raspberry Pi.

Step 1: Set up a small network

The simplest network is a crossover cable connecting the two computers. To find out if your Ethernet cable is a crossover, look at both ends side-by-side; if they have the same colored wires in the same order, it isn’t a crossover cable. I had an old four port hub/switch, so I just plugged the Pi and the Mac into that.

Step 2: Configure the network interfaces

On the Mac, open up your Network Preferences and select the wired Ethernet interface from the list at the left. It is probably set up to automatically acquire an IP address; change this to Manually and enter the values shown in the screenshot:

What we’re doing here is just manually setting up a network on the subnet 192.168.10.X with two nodes. You can use other values as long as the first three numbers are the same on the Mac and the Pi.

On the Raspberry Pi, open a new shell (on Raspbian go to Accessories/LXTerminal). Type:

sudo pico /etc/network/interfaces

(Of course, substitute your text editor of choice for pico.) Comment out the line:

#iface eth0 inet dhcp

and add the lines:

auto eth0
iface eth0 inet static

Now restart the network interface:

sudo ifup eth0

You should now be able to ping each computer from the other now. Try this out to test the network:


PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.823 ms
64 bytes from icmp_seq=1 ttl=64 time=0.798 ms

Looks like it’s working. You should be able to ssh into the Raspberry Pi from your Mac now, if you like:

ssh raspbian@

3. Install the proxy server

The proxy server is a small program running on the Mac (which is connected to the Internet via Wifi) that listens on a port for http requests. The proxy then grabs the requested resources and forwards them to the requestor. For a proxy on the Mac I used Squidman, a port of Squid with a graphical interface. I didn’t shop around, but Squidman looks excellent to me ( Install the application from the .dmg and run it. You don’t really need to change any of the default settings, but I explicitly listed the IP address of the Raspberry Pi in the Clients tab of the Preferences panel. Click “Start Squid” and you’re good to go.

4. Point the Raspberry Pi at the proxy

If you’re developing on the Raspberry Pi, you’ll be using the apt package manager a lot to install software. To configure apt to use a proxy server, add a new configuration file:

sudo pico /etc/apt/apt.conf.d/01proxy

Add the following line to the file:

Acquire::http::Proxy "";

When you’re done, run:

sudo apt-get update

You should see apt-get retrieve new lists of packages from the Internet over the proxy connection. Now you should be able to follow any instructions for installing software on the Pi.
To configure your web browser (Midori on the default distributions), go to the Preferences and add the following to the Network tab:

(BTW, if you’re wondering how to take a screenshot on the Raspberry Pi, try: sudo apt-get install scrot; scrot).

I’d be the first to admit that my sysadmin skills are a bit rusty and grounded in the 20th Century. If anyone has a better solution to share (or wants to adapt this for Windows or Linux), please post in the comments!

Next stop, installing Pure Data…

20 thoughts on “Use Your Mac Laptop as a Wireless Proxy for Raspberry Pi

  1. John Laur says:

    This method is overcomplicated; there is a far simpler method:

    First, you do not need a switch and crossover cable. All macs of Powerbook G4 vintage onward have gigabit ethernet ports with Auto-MDIX which means they will automatically detect which lines are TX and RX. Just plug the two ports together with any ethernet cable.

    You also don’t need a proxy server. Just use the built-in OS X Internet Sharing. This setting is under the Sharing pane in System Preferences. Enable it and choose to share your wireless connection with clients on Ethernet. This will automatically enable a DHCP server running on the Ethernet interface along with appropriate NAT services, DNS proxy, etc. Now you won’t have to configure every single thing to tunnel through Squid.

    On a Windows machine the setup will be similar. Most modern laptops have gigabit ports with auto-MDIX though this is not a guarantee. You can use Internet Connection Sharing in much the same way as Mac OS X’s Internet Sharing, but on Windows there is also a bridge driver that allows you to transparently bridge the ethernet and your wireless connection (This doe not work with some wireless drivers). To use this, open up the screen where you can view your network connections. Select your wireless connection and wired connection right click and select Bridge Connections.

  2. Shawn Wallace says:

    Even better; thanks!

  3. Dakl says:

    Overcomplicated yes.

    1) doesnt matter if its crossover or not
    2) On the mac, go to sys prefs, sharing and choose internet sharing. From wireless to ethernet. No need for the proxy stuff.

    You still have to set up the interface as described tho.

  4. Braden says:

    i just use my logitech revue to connect to the wifi. router-revue-pi took me about 2 minutes to set up

  5. Mark says:

    Crazy complex. Turn on “Internet sharing” on the Mac and connect with an ordinary Ethernet cable. Done.

  6. Joe says:

    Why not just use a usb hub for a wireless adapter?

  7. Dave Potts says:

    If you use “Internet sharing” on the Mac, can you then SSH from the Mac to the Pi? If so, how do you find out the IP address the Mac has assigned to the Pi if you are running the Pi headless?

    1. Dave Potts says:

      Answering my own question, I think you can find the allocated IP address by letting the Pi boot and do the DHCP and then on the Mac running…

      grep OFFER /var/log/system.log

  8. Eswar says:

    This is the only ‘how to’ worked on my rpi with the mac shared internet thru ethernet! Thanks a lot!

  9. derek says:

    Thank you for the “old ‘school” tutorial. I haven’t been able to connect at work, through splash screens and “I agree” prompts. The proxy was the answer.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Shawn Wallace

Shawn Wallace is a MAKE contributor, artist, programmer, and editor living in Providence, R.I. He designs open hardware kits at Modern Device and organized the Fab Academy at the Providence Fab Lab. He makes iPhone synthesizers with the Fluxama collective and is a member of the SMT Computing Society.

View more articles by Shawn Wallace


Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).