Skip to content

Instantly share code, notes, and snippets.

@ericdke
Forked from kerker00/gist:63d52c7b0e6a5df1d2bc
Last active October 8, 2017 12:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericdke/75a42dc8d4c5f61df7d9 to your computer and use it in GitHub Desktop.
Save ericdke/75a42dc8d4c5f61df7d9 to your computer and use it in GitHub Desktop.
Relaunch app
let task = NSTask()
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep 0.2; open \"\(NSBundle.mainBundle().bundlePath)\""]
task.launch()
NSApplication.sharedApplication().terminate(nil)
@briggsm
Copy link

briggsm commented Dec 9, 2016

Swift 3.0 version:

let task = Process()
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep 0.2; open \"\(Bundle.main.bundlePath)\""]
task.launch()
NSApplication.shared().terminate(nil)

@KyLeggiero
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment