Open a file from the command line with a specified application path

terminal

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.

Best Answer

Execute the command-line as per the following syntax:

open [-a application_path] file_path

i.e.

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