2

I have a bunch of .gitignore files, spread across multiple folders. I want to change the default app for all current and future .gitignore files.

I tried to do this via Get Info -> Open with -> Sublime text -> Change All. I get the following error:

An error occurred while changing the application that opens ".gitignore" because not enough information is available.

I tried to do this via duti and it didn't work. duti says that 'com.sublimetext.4' is associated with all .gitignore files:

duti -x gitignore
    Sublime Text
    /Applications/Sublime Text.app
    com.sublimetext.4

but .gitignore (existing and new) files are still being opened with TextEdit.

1 Answer 1

1

I believe the way you used duti will only work for files with the 'gitignore' file extension. However since the '.' is the first character, macOS does not see it as a filename extensions, but rather as a file without any extension and the name '.gitignore'.

What might work is changing the default editor for all text files using duti, so instead of going by filename extension, you would go by UTI, which for text files is "public.plain-text".

I think the command would be

$ duti -s com.sublimetext.4 public.plain-text all
1
  • This is a good idea but it does not work for me. .gitignore is still being opened with TextEdit. The Kind for .gitignore is Document (according to Get Info). According to $ mdls .gitignore, the UTI for .gitignore is undefined (mdls does not list the field kMDItemContentType.)
    – James
    Commented Aug 28, 2023 at 0:36

You must log in to answer this question.

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