尝试tmux
从命令行(Terminal.app)的内部(通过MacPorts版本1.9a安装)打开一个应用程序,并得到以下结果:
$ open /Applications/Adobe\ Reader.app/
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Adobe Reader.app.
如果在tmux外部执行,则从同一终端使用相同命令也可以正常工作。
应该从主机上读取环境;以下是tmux.conf中的内容:set -g update-environment -r
重新启动terminal.app或tmux时,有时它起初会以不同的消息出错(请参阅下文),然后再次尝试时,将给出上述错误-10810。
$ open /Applications/Adobe\ Reader.app/
The window server could not be contacted. open must be run with a user logged in at the console, either as that user or as root.
我已经尝试了苹果自己的应用程序(预览,字体集,通讯录)和第三方(Adobe,Evernote等)。没有不同。似乎确实有效的一个应用程序是finder。(open [dirname]
例如。)
有一个解决方案/解决方法:
reattach-to-user-namespace
。tmux使用它来执行程序。我使用brew而不是macports,所以我做了:brew update; brew upgrade reattach-to-user-namespace
。Macports可能能够做类似的事情。将以下内容添加到您的.tmux.conf
文件中:
set -g default-command "reattach-to-user-namespace -l /bin/bash"
重新启动tmux会话,这应允许您从命令行启动程序。
可以在此github问题上找到更多信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句