Shortcut to terminal app with arguments and without terminal remaining open

Discussion in 'macOS' started by therealmuffin, May 10, 2011.

  1. therealmuffin macrumors newbie

    Jun 5, 2008

    I have an application (GMPC) that is started from terminal. I can create a shortcut to that program with "ln -s 'loc. program' name_shortcut". However, I would like to pass an argument to it (like --fullscreen). In addition I would like the terminal window not to remain open. I was wondering if one or both are possible.

    Thanks in advance, Maarten
  2. GGJstudios macrumors Westmere


    May 16, 2008
    I'm not sure about the argument but you can close Terminal with the command "killall Terminal".
  3. jtara, May 10, 2011
    Last edited: May 10, 2011

    jtara macrumors 65816

    Mar 23, 2009
    But that will kill any sub-processes of the terminal application as well. That would mean the application that was launched from the terminal...

    What you are creating is not a "shortcut", though, but simply a symbolic link. It's just an alternate name for a file in the filesystem. It doesn't allow you to set command-line parameters, the working directory, or environment variables, as you can with desktop shortcuts. Indeed, a symbolic link has no knowledge of file content - it's unaware whether the file is an application or a data file.

    Unfortunately, OSX (despite being the "superior" GUI) lacks this capability which both Windows and Linux have.

    Best you can do is create an Applescript. See here for a discussion:

    Looks like MacScriptGUI is the closest thing you'll find to a Windows/Linux desktop shortcut.
  4. GGJstudios macrumors Westmere


    May 16, 2008
    I'm not familiar with that app. Does the app run in Terminal, or does it only get launched in Terminal? If the app has already been launched, it won't be affected if you quit Terminal. If you need Terminal to remain running, go to
    Terminal > Preferences > Settings > Shell and select "When the shell exits: Close the window"
    Then when you type "exit" in Terminal, it will close the window but leave Terminal running.
  5. wrldwzrd89 macrumors G5


    Jun 6, 2003
    Solon, OH
    If the application in question is a faceless background application, and you simply want to start it with arguments, then quit the Terminal - this is actually easy to do.

    Make a little plain text file with a .command extension (instead of .txt), and put this in it:
    /path/to/program argument1 argument2 &
    killall Terminal
    That ampersand at the end tells Terminal to run the application in the background, effectively detaching it from the shell session.
  6. therealmuffin, May 11, 2011
    Last edited: May 12, 2011

    therealmuffin thread starter macrumors newbie

    Jun 5, 2008
    Thanks all for your input. That little shell script works like a charm.


    ps. GMPC runs in X11 and is a client musicplayer/controller for a music database (Music Player Daemon or MPD).

Share This Page