'Open URL on macOS via command line
How can I open a URL on macOS via the command line?
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chino22 |
| Solution 2 | Luke Pighetti |
