Background of this question:

I built an application by LabVIEW to open .tdms file, and I know it can receive arguments that pass to it because following code works just fine:

open -a /Application/My.app --args /path/to/file.tdms

Since command line works, I decided to associate .tdms to my application so that I can double click the file to open it, and I succeed by modifying My.app/Contents/info.plist.

And things get interesting, when I try to open file either by double-click or choose app in "Open With..." list, a pop-up window shows

"My.app" is damaged and can’t be opened. You should move it to the Trash.

Some suggested xattr -cr /Application/My.app would solve the problem, but it doesn't work for me.

That's why I want to know what does macOS actually do in the background when open file? How does the arguments pass to application?

Additional info:

  1. I use "Open Application Reference" and Property Node in LabVIEW to receive arguments that pass to my application.

  2. I added following code into info.plist to associate filetype to my app:

            <string>National Instruments TDMS File</string>

1 Answer 1



macOS includes Launch Services. This code is responsible for launching applications and providing those applications with the details of files to open or print:

Launch Services is an API that enables a running application to open other applications or their document files or URLs (uniform resource locators) in a way similar to the Finder or the Dock. Using Launch Services, an application can perform such tasks as:

  • Open (launch or activate) another application
  • Open a document or a URL in another application
  • Identify the preferred application for opening a given document or URL
  • Register information about the kinds of document files and URLs an application is capable of opening
  • Obtain appropriate information for displaying a file or URL on the screen, such as its icon, display name, and kind string
  • Maintain and update the contents of the Recent Items menu


To open files, graphical applications on macOS are sent AppleEvents of type odoc:

Event that provides an application with a list of documents to open. Sent, for example, when a selects one or more documents for your application in the Finder and double-clicks them.

The launched application's arguments do not include the paths of the files to open.

  • Thanks Graham, your answer do solve my confusions, guess I have to learn how to build app via xcode... I am totally new to xcode. Besides, do you know where can I find example codes regarding how to use "AEOpenDocuments"? I tried to google it but no luck...
    – nochenon
    Commented Sep 19, 2019 at 19:42
  • 1
    Helpfully NSDocumentController and NSDocument handle the AppleEvent for modern applications; see Developing a Document-Based App. Good luck! Commented Sep 20, 2019 at 4:29

You must log in to answer this question.

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