Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the open command from the Terminal to open an app bundle and would like to pass a command line argument through to the underlying executable.

Is this possible with the open command?

The reason I am using the open command at all here is that it doesn't tie up a Terminal window to support the launched process. Are there alternate ways to do this other than the open command ?

More Information:

The application I am looking to run is an open source visualization program (Paraview) which I have compiled myself. I know that the basic executable does indeed take command line args. The executable itself is located inside the app bundle paraview.app/Contents/MacOS/paraview.

share|improve this question
    
Can you give more details about which app(s) you're launching? Different apps will deal with command line arguments differently (some will probably just ignore them). – Doug Harris Aug 26 '10 at 15:05
    
@Doug Harris - I've added some more info to the question. Thanks. – dtlussier Aug 26 '10 at 16:07
up vote 5 down vote accepted

As per $man open, you might be successful with $open MyApp.app --args argument1

Of course, you could always just run the executable directly and follow your command with an ampersand—that'll background it.

$/path/to/My.app/Contents/MacOS/executable argument &

share|improve this answer
    
Looks like --args is a new option in 10.6. – dtlussier Aug 26 '10 at 17:02
2  
Following the command with & does indeed put it into the background, but the process remains a child of the shell in which it was created. Avoiding this is one of the advantages of open. – dtlussier Aug 26 '10 at 17:02
    
Ah, excellent point--I wasn't aware of that behavior for GUI apps. – NReilingh Aug 26 '10 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .