Launch an app on OS X with command line

前端 未结 12 1049
北恋
北恋 2020-12-04 06:03

I want to launch an app on OSX from a script. I need pass it command line arguments. Unfortunately, open doesn\'t accept command line args.

The only opt

12条回答
  •  清歌不尽
    2020-12-04 06:43

    An application bundle (a .app file) is actually a bunch of directories. Instead of using open and the .app name, you can actually move in to it and start the actual binary. For instance:

    $ cd /Applications/LittleSnapper.app/
    $ ls
    Contents
    $ cd Contents/MacOS/
    $ ./LittleSnapper
    

    That is the actual binary that might accept arguments (or not, in LittleSnapper's case).

提交回复
热议问题