Is there a way to open a file from the command line with a specific application, where I specify the application by path, not name?

So something like:

open file.txt -a /path/to/chosen_app.app

instead of:

open file.txt -a "chosen_app"

Use case for this is speeding up my workflow. I'm developing an application that is opened by double clicking on a certain type of file. Currently I'm right clicking on the file, choosing "Open With" then "Other" and selecting my .app. Without having to install my app each time I change it, I'd like to just build it, then from the command line open the file with my newly built application.

1 Answer 1


Execute the command-line as per the following syntax:

open [-a application_path] file_path


open -a /path/to/chosen_app.app file.txt.

  • Excellent, thanks - the bit I was missing was using an absolute path.
    – CodeBuddy
    May 15, 2018 at 10:16
  • Going through the man page (man open) always helps.
    – Nimesh Neema
    May 15, 2018 at 10:17

You must log in to answer this question.

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