17

Accessing a Mac using Apple Remote Desktop or VNC is brutally sluggish. I'm trying to write software and it is too painful to use. The screen does not refresh in a useful period of time. I googled it to death and came up nothing - mostly... At the moment I am using Monterey, which changes the solution a bit. But the problem goes back for years.

0

2 Answers 2

20

I am providing my solution here to hopefully help others who are still struggling or who have given up.

The problem is not ARD or VNC per see. But the default configuration of the macOS TCP stack. At some point in ancient history, Apple tuned the default network settings to try save on network traffic. As such, it will not send a return ack packet until it has collected enough packets to make the trip worthwhile. This probably made a big difference with dial-up modems. But for a real-time app like remote desktop viewing, it makes it unusable. And my 1Gbps fibre connection certainly won't care about a few extra packets...

The answer is to set: net.inet.tcp.delayed_ack=0 in /etc/sysctl.conf. Now it will send the Ack packets immediately (like everybody else on the Internet). That's the whole point of an ack...

The second part of the problem is that the /etc/sysctl.conf file has been deprecated since Big Sur and Monterey. Eventually, I found the solution in making a plist file in /Library/LaunchDaemons. This will get loaded on each boot and will be a permanent fix.

The solution is easy to find if you already know the answer.

Just create this file, reboot, and live happily ever after...

sudo vi /Library/LaunchDaemons/com.startup.sysctl.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.startup.sysctl</string>
    <key>LaunchOnlyOnce</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/sbin/sysctl</string>
        <string>net.inet.tcp.delayed_ack=0</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Okay. It's better. But VNC is still kinda sluggish. If you want it to go even smoother, install xRDP server on the Mac.

I used a variation on these instructions...

https://ryancreecy.com/2019/10/29/xrdp-on-mac.html

https://web.archive.org/web/20220316055107/https://ryancreecy.com/2019/10/29/xrdp-on-mac.html

8
  • 1
    To read the current value: sudo sysctl -a | grep net.inet.tcp.delayed_ack - to set a new value only until the next reboot: sudo sysctl -w net.inet.tcp.delayed_ack=0
    – da4
    Mar 1, 2022 at 16:21
  • Odd - I don’t use any of these and remote into machines for hours a week - both across the city and across the globe. What sort of network conditions are between your VNC client and the mac host?
    – bmike
    Mar 8, 2022 at 3:09
  • To read the current value, you don't need sudo and don't need -a | grep either. Just sysctl net.inet.tcp.delayed_ack is enough. And to write a new value until next reboot, you don't need -w, which "has been deprecated and is silently ignored". But unfortunately, that doesn't seem to improve the VNC speed much...
    – mivk
    Aug 7, 2022 at 13:16
  • 1
    @myusrn I’m always on macOS using the native screen sharing, screens app or Apple Remote Desktop. When I come from Linux or windows I use TeamViewer.
    – bmike
    Sep 4, 2022 at 2:52
  • 1
    @myusrn, Wayback machine... https://web.archive.org/web/20220316055107/https://ryancreecy.com/2019/10/29/xrdp-on-mac.html Sep 5, 2022 at 1:51
0

I had the same problem of slow VNC in LAN. These are main things I see that corrected it:

One was enabling "Reduce transparency" in Accessibility / Display in System Settings and "Reduce Motion" in the same settings area.

Two, setting encoding to "Raw" in TigerVNC Client settings; and compression to "0" and I just let the ssh -C do the compression as mentioned in other posts.

Night and day difference for Xcode.

You must log in to answer this question.

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