I was writing a .sh script for opening a bunch of apps and i was looking for a way to force my apps to launch minimized.

The open command man page usage prompt, (displayed when you run open without args) says:

-j, --hide Launches the app hidden.

but some apps are still opening in the foreground (i.e. Chrome and Airmail).

I'm running El Capitain (10.11.6) and using zsh.

Do you know why those apps behave like that or if there's another way to accomplish this in bash?


  • What version of macOS are you using? -j is not listed in the man page in El Capitan, or Mavericks, for that matter. – tubedogg Oct 13 '16 at 19:30
  • i'm running El Capitain (10.11.6). I'm updating my question to add some more infos. – le_vine Oct 13 '16 at 20:19
  • 1
    @le_vine This is because GoogleChrome uses different approach to display the app. Check the .app bundle and You'll see that it spawns the /Applications/Google\ Chrome.app/Contents/Versions/XX.X.XXXX.XX/Google\ Chrome\ Helper.app processes. When newer version of GoogleChrome is installed only the filder in Versions is changed. – Mateusz Szlosek Oct 17 '16 at 13:33

Google Chrome uses different mechanism to display the app, so the standard -j switch does not work as expected in this case. Main process spawns the Google Chrome Helper processes for every tab. If you check the .app bundle, you'll see it resides in /Applications/Google\ Chrome.app/Contents/Versions/XX.X.XXXX.XX/Google\ Chrome\ Helper.app. You can't launch it directly, because main app has to be running.

I couldn't find the other way around than just creating osascript like this:

open -j /Applications/Google\ Chrome.app && sleep 1 && osascript -e 'tell application "System Events" to set visible of application process "Google Chrome" to false'

However this will create 1 sec. delay in your script.

  • i'll try that right now! so basically this is what macOS do when i check the hide checkbox in the Login Items page inside user settings? – le_vine Oct 20 '16 at 9:59
  • it works! for some apps (i.e. airmail) i have to set a bigger sleep time but it works fine! thanks – le_vine Oct 20 '16 at 10:16

You must log in to answer this question.

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