7

I am looking for an easy way to start different GUI OS X applications from the command line and with different parameters.

If possible I would like to add them to the system PATH in order to call them easier.

Note: I tried open -a "Google Chrome" --args --disable-plugins and it started Chrome but without disabling the plugins.

3

3 Answers 3

4

Normally you can find the actual executable in the Contents/MacOS folder of the Application bundle. For Chrome try it like so:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-plugins
3
  • 1
    Have you tried it? For me it starts Chrome with the plugins enabled.
    – sorin
    Mar 15, 2011 at 10:37
  • @sorin-sbarnea Given your problem here and in the question I suspect Chrome has a problem here. I have used Chrome with some arguments in both ways
    – mmmmmm
    Mar 15, 2011 at 11:09
  • this does not work in the same manner as openning the application.
    – AbiusX
    Mar 16, 2011 at 1:31
1

Generally, you do something like this:

exec "/Applications/MyApp.app/Contents/MacOS/MyAppExecutableFile" [arguments]

Running the exec commmand is important, it will end the terminal session and load the command you want. This way you won't kill your program by quitting Terminal or closing the window.

Be sure to also note what the standard flags are set when you double-click the application in the Finder (I've seen about 4 or 5 standard ones) and pass them too for consistent behavior.

As for what you want to do, check the documentation for the application in question.

I don't know if that is the right flag for Chrome, so I can't comment there.

-2

This DOESN'T enable you to send an argument to the application, but I found my way to this thread trying to find a way to open an application from the command line so will at least share how to do that in case anyone else ends up in the same position.

It might work to make an alias in ~/.bash_profile.

For example:

alias affinity="open -a Affinity\ Designer.app"

(No path necessary. Hmm.)

Works for something like:

$ affinity path/to/file.png
3
  • -1. This will open a file with the given app, but it cannot be used to pass arbitrary arguments. Oct 27, 2015 at 7:09
  • Right. I found my way to it trying to simply find a way to OPEN an app from the command line. I'll edit my reply to at least specify that it doesn't really address the OP's question.
    – MikeiLL
    Oct 27, 2015 at 19:12
  • Leaving my downvote because this post still doesn't answer the question. (It would be a better fit for this question, but a similar answer has already been posted there.) Oct 27, 2015 at 21:16

You must log in to answer this question.

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