DEV Community

Filipe Mesquita
Filipe Mesquita

Posted on

How to change the default app for files of a particular type in the mac terminal

https://superuser.com/questions/273756/how-to-change-default-app-for-all-files-of-particular-file-type-through-terminal

Install duti: brew install duti

Now you need to find the id of the app you want to use, and assign it to the extension you want to use it for. In this example, I already use Brackets for *.sh and I want to also use it for *.md files instead of xcode.

Get the default app id for .sh files: duti -x sh

output:
  Brackets.app
  /opt/homebrew-cask/Caskroom/brackets/1.6/Brackets.app
  io.brackets.appshell
Enter fullscreen mode Exit fullscreen mode

The last line is the id.

Use this app id for all .md files: duti -s io.brackets.appshell .md all

Top comments (0)