I'm trying to connect two Macs that are not in the same Wi-Fi network. I'd like to use terminal instead of available Remote Desktop programs.

My remote Mac had already all the preferences active in "sharing" prefs. Problem is... while I can do that from the same network using

open vnc://name.IpAddress

But I have no idea how to do that from different networks. I'd like to be able not only to enter the remote Mac, but also see the screen.

I do have full control over the hardware and software from beginning to end. The Mac will never have a monitor attached and runs my scripts and my software only. I buy the hardware, install my software, and ship. I am able to have the machine connect to their Wi-Fi so that I have all the system info needed uploaded to the database. Like local IP address... and basically everything I tell the script to do.

How can I remotely connect to the Mac from a different network ?

  • 3
    I'm voting to close this question as off-topic because it’s not about Apple hardware, software, or services as defined in the Help Center – Allan Jan 6 '20 at 11:57
  • 1
    @Allan It's probably on-topic on several SE sites, but right now it's missing crucial detail to be on-topic on any :-) – nohillside Jan 6 '20 at 12:14
  • 1
    Allan is correct in pointing out that the changes you need to make on the routers etc, and/or how to setup a VPN is beyond the scope of AD. All we can help you with is to figure out which ports need to be open (and even that is already documented on support.apple.com). So if you want we can migrate this to Superuser. – nohillside Jan 6 '20 at 14:02
  • 1
    ok, thanks anyway! my bad I did not realise it was quite OT. See you next then! ;-) – liuk Jan 6 '20 at 15:08
  • 2
    In my opinion this is completely on-topic. This is the daily routine of Mac service providers managing remote Macs. Apparently no commercial tools though... – klanomath Jan 6 '20 at 15:57

Assuming you have a central and stationary management unit (a Mac) and several remote Macs (1:n relationship), I would choose an inverted VPN-approach:

  1. Set up a VPN-server on your central Mac. The network address of the VPN-net mustn't collide with local network addresses. Port-forward all necessary ports to your Mac on your local router. Depending on your Internet service provider and your Internet connection get a dynamic DNS-address.
  2. Set up VPN-clients on the remote Macs and connect them to your central VPN-server. The clients mustn't route all traffic via the VPN-connection.
  3. Enable Screen Sharing on the clients
  4. Connect "locally" with your VNC-app.

Since the question misses some details (e.g. macOS versions/number of remote Macs/safety rules in the remote networks/24-7 service/Internet & network stability locally and remote etc.), I can't answer the question in all its particulars.

  • Hi @klanomath, and thanks a lot for your answer. Might be exactly what I was looking for ;-) Let me give you the setting I'm having: - OS Mojave - remote Macs could be hundreds in the future - no firewall, basic security I would say - Average Internet stability, no big issues expected So to recap I'd like to enter any computer when I want without user interaction on the other side (they are headless). Also as I program the scipts in them I know anytime their IP address (local and public) and all the passwords – liuk Jan 7 '20 at 15:59
  • @liuk "...hundreds of Macs": Then you have to ensure that the VPN-net is in the network range. "...average Internet stability...": You have to ensure that the remote VPN-clients try to reconnect to the VPN-server reliably if the Internet breaks on the client or the server side. To be honest, with literally hundreds of Macs I would choose some pro solution... – klanomath Jan 7 '20 at 16:17
  • I see. Well, thanks anyway @klanomath as you were able to give me some indication! ;-) One last question? Any service you would recommend given my requirements? Should I maybe consider Apple Remote Desktop (since all computers are Mac and share the same Apple ID) or I should go with some standard like Team Viewer? – liuk Jan 7 '20 at 17:01
  • @liuk If you go with TeamViewer, you can skip the VPN. Also, don't use the same Apple ID on hundreds of Macs. In general, I think you should look into MDM solutions (Mobile Device Management) and Apple's DEP. That's the right way to manage a fleet of Apple devices. – Andreas Ley Apr 5 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .