简体   繁体   中英

Open URL on macOS via command line

How can I open a URL on macOS via the command line?

I have found two ways to open a URL on macOS via command line

1.

open https://google.com
on run argv
    tell application "Safari"
        open location item 1 of argv
        activate
    end tell
end run
osascript open-safari.applescript https://google.com
open location <theUrl>

Is Known by AppleScript and can open the url directly. The default browser will be triggered. No need to invoke Safari explicitly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM