osx - Can a Cocoa app's executable steal focus from caller? -
say have standard cocoa application call foo.app (like 1 choosing new project > cocoa application in xcode), if open app via terminal using: open foo.app/ then see foo's name on status bar top , window in focus, in front of other apps. if instead directly call terminal executable buried in .app folder, like: foo.app/contents/macos/foo nothing appears happen. on inspection app has indeed opened not in focus (the terminal still is), have find on dock or find window. is there way foo application make sure in focus when run? if run via executable described above? your app can "steal focus" calling [[nsapplication sharedapplication] activateignoringotherapps:yes]; see nsapplication docs more info.