1

I'm trying to use launchd from terminal to start app with command line arguments. I followed along here but can't figure it out: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/launchd.8.html

I'm trying to launch: /Applications/Firefox.app/Contents/MacOS/firefox -profile "blah blah" -no-remote

thanks!

1 Answer 1

2

You don't need to directly use launchd for that and probably shouldn't.

You can just use:

open -a Firefox --args -profile "blah blah" -no-remote 

Or:

open -a /Applications/Firefox.app --args -profile "blah blah" -no-remote 

Or:

open -b org.mozilla.firefox --args -profile "blah blah" -no-remote 

If Firefox is already running, then the above will just bring it to the front and activate it. In that case, the args are ignored because they are only meaningful when launching the app.

If you want to launch a new process even if the app is already running, pass the -n option to open, before the --args option. Like:

open -a /Applications/Firefox.app -n --args -profile "blah blah" -no-remote 
Sign up to request clarification or add additional context in comments.

2 Comments

Will test now thanks @Ken! The reason I asked this is because when I open with nsIProcess of Firefox which seems to use posix_spawnattr_init (im not sure im not a c guy :P) here in source: dxr.mozilla.org/mozilla-central/source/xpcom/threads/… but that puts its PID on the locked files of the launching process as i posted here: stackoverflow.com/questions/28773538/…
IT WORKS!!!! THANK YOU @KEN!! I can't tell you for how long I struggled with this!!!! AND it doesn't lock the launching process!!!! And no PID pollution!!!!!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.