2

Safari can ben opened from a terminal automatically

open -a safari

When comes to close it, I have to press 'Cmd+Shift+W' or click quit option in dock

Is it possible to quit safari automatically? like

close -a safari
2

One of the Apple-supported ways to do it is the following AppleScript command:

tell app "Safari" to quit

Use the following one-liner to run the same thing from your shell:

osascript -e 'tell app "Safari" to quit'

Or, use the bundle ID if that’s more your thing:

osascript -e 'tell app id "com.apple.Safari" to quit'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .