0

I'm trying to figure out why this command script isn't working.

killall Google\ Chrome;

open /Application/Google\ Chrome.app -args --disable-restore-session-state

. I am trying to kill any instance of Chrome that happens to open on startup. Then launch Chrome with an argument. I have to run the script twice to get Chrome to launch. Can anyone help?

1 Answer 1

1

I also had to run killall Google\ Chrome; open -a Google\ Chrome --args --disable-restore-session-state twice if Chrome was already open. Either of these worked the first time though:

osascript -e 'quit app "Google Chrome"' 2> /dev/null && sleep 0.5; open -a Google\ Chrome --args --disable-restore-session-state

killall Google\ Chrome 2> /dev/null && sleep 0.5; open -a Google\ Chrome --args --disable-restore-session-state

killall sends the process a TERM signal, which should generally be safe, but sending Chrome a quit Apple event allows it to for example ask for confirmation if there is unsubmitted text in a form.

open -a is usually just as fast as specifying the full path to the application bundle.

You must log in to answer this question.

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