Recently, I received a RPI zero w for a potential side-project at work, mounted the latest raspbian image to it and set it up for ssh'ing via USB using this tutorial. I was unsuccessful in ssh'ing into it using my work laptop (2012, sierra, 15" screen) using the ssh [email protected] command, and finally gave up. I keep getting the error message ssh: Could not resolve hostname raspberrypi.local: nodename nor servname provided, or not known. When I got home, I attempted the same thing via my personal macbook (mid-2015, el capitan, 13") and I have no problem ssh'ing into the pi. Hopefully, I can just get it setup to connect automatically to the wireless network at work by adding it as a network in wpa_supplicants.conf, and then just ssh over the wireless network, but i fear that i'll need to initialize the connection using the sudo ifup wlan0 command while in range of the network for that to work, which will require first ssh'ing via USB.

Regardless, I'd like to be able to ssh into the pi for machines other than my personal macbook. I attempted to ssh into on 3 machines at work, all of which i believe are running sierra, and have had no luck thus far. My guess is that this is macOS version related, but I'm not sure given the small sample size.

Is there some setting or other configuration I need to enable ssh over usb for other macbooks?

All I've essentially done to the headless raspbian(Stretch, version 9) image is:

  • touch ssh in the boot directory
  • add dtoverlay=dwc2 to the bottom of config.txt
  • add modules-load=dwc2,g_ether after the rootwait setting in cmdline.txt

3 Answers 3


How have you set up the RNDIS network on the Mac?

You should find when the Pi is connected the System Prefs / Network page has a RNDIS device created. This is the Macs link to the Pi and determines both the Pi network address and its link to DNS.

This assumes your main network is 192.168.1.x and the DNS server is the Internet router at

Off the top of my head everything is in advanced and I would : Configure IPv4 Manually IP address (This is the MAC address for the new Mac/Pi network) Subnet DNS

You then need to set Internet sharing in System Prefs / Sharing - the top box needs to be set to the Mac internet device (WiFi or Ethernet normally) and the bottom box / device is the RNDIS adapter you have above.

If you are using Buster the Pi should then reconfigure and pop up as raspberry.local (assuming you have not changed its hostname) and normally with as its IP address

No idea on IPv6 - sorry but it just seems to work when IPv4 is set up :-)

Be default the Macs support mDNS (Bonjour) and it starts automatically - use NETATALK to share files between he Mac and the Pi.

NOTES: Turning on Internet Sharing buggers sleep mode on the Mac. Remember to shutdown the Pi before turning of the Mac.

If you get stuck - drop a note here and I can fire up a Pi Zero and check everything


The "Could not resolve hostname ..." message indicates the issue is more basic (the issue isn't specifically related to ssh. Anything that needs to access the remote host would fail with a similar error.)

Test this via ping raspberrypi.local

I am not in an office where I can test this, but as I recall... mDNS is based on link-local addresses which means both hosts must be reside on the same subnet.

Most home networks are just a single subnet ... which may explain why it works at home. At an office, you Pi and Mac might not necessarily be on the same subnet (especially if the Mac is using a wired network connection instead of WiFi). If this is the case, you can likely work-around the issue by disconnecting the Mac from the wired connection and connecting it to the same WiFi being used by the Pi Zero W.

If you know the IP address assigned to the Pi, you can add it to the /etc/hosts. E.g. if your Pi has an IP address, then create an entry in /etc/hosts which reads raspberrypi (omit the ".local" since that suffix is a domain name reserved for use only by mDNS). Then connect via ssh pi@raspberrypi.

You can check to see if mDNS is running on the Mac (it probably is) via ps -ef | grep mDNS and can use sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist to start it if it is not already running (but I expect it probably will already be running.)

My guess is that when you use the Pi & Mac at the office, the devices are not on the same subnet. I would likely start here.


You need to install Bonjour Service on windows machines. Bonjour is running on macs by default as its used by iTunes ect

Soon as you install you should be able to connect

ssh raspberrypi.local
  • the 3 machines I tested ssh [email protected] are all macbook pros. i haven't been using any windows machines, per the question. but i will confirm that mDNSResponder is running on all 3
    – heliotrope
    Oct 10, 2017 at 2:18
  • Yeah sorry about, im not sure why I though you had trouble using a windows machine, I was temporary cross-eyed I think.
    – Dr.Rabbit
    Oct 10, 2017 at 2:34
  • yea, no problem.. I can see where you'd get that idea when I said the OS might be the problem (I was referring to OS version). So...I just randomly tried the command again on my worktop, and after a handful of tries...it worked. Strange.
    – heliotrope
    Oct 10, 2017 at 2:36
  • any updates available for itunes ect?
    – Dr.Rabbit
    Oct 10, 2017 at 2:38
  • it says 'no updates available' in the app store
    – heliotrope
    Oct 10, 2017 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.