MacOS – the technical term for the file-open capability of macOS programs

filemacos

What is the technical name of the following file-open capabilities of macOS programs?

  • open a file that is dragged from the Finder onto the applications’s dock icon
  • open a file from the "Open with" Finder dialog in a specific application
  • open a file that is "sent to" the application by a third party application like LaunchBar?

Best Answer

In all instances, it's called "opening a file." macOS (like other operating systems including Windows and Linux) support multiple methods of opening a file.

  • Drag and Drop is supported throughout the OS. If you drag and drop a file onto another graphical element, it will (attempt to) open that file within the context of that element. If it's a folder, Finder will open that folder to accept the file. If it's an application, it will open that application with that file (as input).

  • Open With is just an alternative to the default action of "Open" in Finder which uses the file's default associated application. This allows you to select from alternates registered with macOS or manually select an app.

  • A 3rd party app does the same thing by opening a file with it's associated default or alternate application. There's no different method of opening files as already provided for by the OS.

The applications associated with different file types are registered in LaunchServices. So a PDF might be associated with Preview or Adobe Acrobat Reader. LaunchServices will have those relationships established within it's database. This is how "Open With..." is populated with alternate apps.

From a command line perspective, this is how you can have a .doc or .docx file automatically be opened by Word, for example when typing

% open foobar.doc

But then, if you want to open it with Pages, you can issue the command

% open -a Pages foobar.doc

You can also launch the application and specify the file as a "command line argument" even for a file that's not even associated with an app (you wouldn't use a browser to view text files even though it is supported).

% /Applications/Firefox.app/Contents/MacOS/firefox ~/Desktop/foobar.txt