macOS下多用户远程RStudio Server绘图故障排查与解决
问题背景
我在iMac上部署了支持多用户和远程登录的RStudio Server,按照官方INSTALL教程完成了源码编译、配置文件设置和launchd守护进程部署。初始运行正常,但一段时间后绘图时出现报错,无法继续绘图,只能重启R再重新运行代码。由于macOS并非官方支持系统,提交Issue后未得到帮助;尝试用Docker运行也没找到合适的macOS用户命名空间映射方法。
报错信息
2022-06-09 08:02:29.438 rsession[3050:139329] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}
2022-06-09 08:02:29.438 rsession[3050:139329] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts
2022-06-09 08:02:29.438 rsession[3050:139329] XType: unable to make a connection to the font daemon!
2022-06-09 08:02:29.438 rsession[3050:139329] XType: XTFontStaticRegistry is enabled as fontd is not available.
解决办法
执行以下命令启动fontd守护进程后,问题已解决:
sudo launchctl load -w /System/Library/LaunchAgents/com.apple.fontd.useragent.plist
内容的提问来源于stack exchange,提问作者Nakor

