为了在终端上通过Safari打开链接(例如Google),我写:
open -a safari https://google.com
如果要在私有窗口而不是标准窗口上打开此链接,是否有方法或标志可以从终端启用它?
此方法要求用户为系统事件启用辅助功能模式,这将向他们显示一个对话框。
您可以在终端中使用AppleScript来执行所需的操作:
osascript -e 'tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Private Window" of menu "File" of menu bar 1
end tell
end tell'