Skip to content

Instantly share code, notes, and snippets.

@segiddins
Last active August 29, 2015 14:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save segiddins/85b4331804fc5b084f37 to your computer and use it in GitHub Desktop.
A tiny app launcher
#!/usr/bin/env ruby
app = requested = ARGV.shift
unless File.executable?(app)
escaped_app = app.gsub(/(.)/, '\\\\\1')
app = Dir.glob("/Applications/#{escaped_app}.app/Contents/MacOS/{#{escaped_app},*}").first
end
Process.detach Process.spawn([app, requested], *ARGV, err: '/dev/null', out: '/dev/null')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment