.app from Terminal

Discussion in 'macOS' started by ilnyckyj, Jan 13, 2006.

  1. ilnyckyj macrumors member

    Joined:
    May 4, 2005
    #1
    How do you execute a .app from the command line?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Sure. Use the open command. open is very clever and uses LaunchServices to open things in the same way as the Finder.

    So open /Applications/iTunes.app will open iTunes.
    open ~/Desktop/file.txt will open file.txt in Text Edit (or whatever you have defined to open text files).
     
  3. ChrisBrightwell macrumors 68020

    ChrisBrightwell

    Joined:
    Apr 5, 2004
    Location:
    Huntsville, AL
    #3
    I've wondered this for a while, but never cared enough to look it up or ask the question.

    Handy tip. Thanks.
     
  4. semaja2 macrumors 6502a

    Joined:
    Dec 12, 2005
    Location:
    Adelaide
    #4
    if its the same as any linux exe cd to the dir and just do this


    cd /Application/
    ./<app name>.app
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    That won't work as <app name>.app is actually a folder. The executable is at <app name>.app/Contents/MacOS/<app name>
     
  6. blackstone macrumors regular

    Joined:
    Dec 12, 2005
    Location:
    Washington, DC
    #6
    If you want to avoid having to type in the path, then you can just use:

    open -a iTunes.app

    The -a switch will make it search the /Applications folder and its sub-folders for the matching file.
     
  7. ChrisBrightwell macrumors 68020

    ChrisBrightwell

    Joined:
    Apr 5, 2004
    Location:
    Huntsville, AL
    #7
    :eek:

    I need to read man pages more often.

    Thanks.
     

Share This Page