MAUI 配对 Mac 问题的解决方法

虽然最后也没能成功连接,但至少解决了以下两个问题

SSH 无法连接

症状

输入用户名和密码后无法通过 SSH 连接 Mac,卡在

尝试用 SSH 密钥与 “Mac IP:22” 建立 SSH 连接时出错

查看日志后发现 IO 错误,无法找到 %LocalAppData%\Xamarin\MonoTouch\id_rsa

解决方法

参考 https://stackoverflow.com/questions/74215881/vs-2022-wont-connect-with-mac-after-ventura-upgrade

macOS Ventura 的 SSH 版本升级到了 OpenSSH_9.0p1,这个版本默认不开启 VS 连接 Mac 时使用的 RSA SHA-1 算法

macOS 下编辑 /etc/ssh/sshd_config 文件,添加两行内容开启 RSA SHA-1

HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

然后重启 sshd

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

重启 VS 重新连接即可

Broker 错误

症状

SSH 连接 Mac 后发生错误,提示

An error occurred while trying to connect to the broker...

The location of Mono has been detected on the server: ........

(忘记截屏中文提示信息了)

解决方法

参考 https://learn.microsoft.com/en-us/answers/questions/1040874/pair-to-mac-an-error-occurred-while-trying-to-conn-1.html

macOS 手动安装 mono 即可

https://www.mono-project.com/download/stable/#download-mac

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据