How to programmatically make cocoa application active
Swift 4.2+ of @Arvin answer
NSRunningApplication.current.activate(options: [.activateIgnoringOtherApps, .activateAllWindows])
Look at [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
.
For 10.6 or greater
[[NSRunningApplication currentApplication] activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];