How to properly register a file extension on mac so it will also work by running open from the command line? I have the following problem, I registered a file extension to be opened by a Mac Application by clicking on the file in Finder and selecting to always use the target application to open the files.

So far it works, BUT it doesn't work with &gt;open filename.ext as it will say:

No application knows how to open /path/filename.ext.


Clearly open works differently than Finder.

If possible I would prefer a command line solution.
If you selected Always Open With from a context menu, it only changes the default application for the selected items. If you change the default application from an information window, it normally also has an immediate effect on open.

If it wasn't that, com.apple.LaunchServices.plist can also be edited as XML:

plutil -convert xml1 ~/Library/Preferences/com.apple.LaunchServices.plist


Applying changes requires restarting. Logging out and back in isn't enough.

You could also try using duti or RCDefaultApp.