Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • I've an app on mac that can intentionally crash that I've tested your above solution with. it will automatically restart the app even after crashing. Is there a way to check the exit of the application? as open will obviously terminate with an exit of 0 so will run again regardless. Commented Jul 24, 2014 at 11:19
  • @BenCrazedUpEuden: My understanding is that open only returns failure for certain startup errors. Applications are started by a system service, not directly, so there's no direct communications channel back. Sometimes it's possible to start the application executable directly: /Applications/YourProgram.app/Contents/MacOS/YourProgram. Otherwise, we're drifting out of Unix and into places you'll get a better answer on Ask Different. You can run AppleScript from the shell with osascript Commented Jul 24, 2014 at 21:51