Close safari automatically 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
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'