1

MacOS is continually using Xcode to open various files in my OS. I already know how to set a default app opener for all files with a particular extension (.txt, .py, etc...), but I can't use this feature with "extensionless" files like .bash_profile. Is there a workaround for this other than changing the default app for each file?

My preferred solution would be if I could tell MacOS to never use Xcode as a default app opener. I'm assuming there is some config file buried away that might help me achieve this but I haven't been able to find anything to help me with this.

Taylor
  • 21
  • 3

3 Answers3

1

Looking for the same I found this answer stop-xcode-from-hijacking-my-file-associations on apple.stackexchange.

It seems that XCode is pretty persistent but using this 3rd party app https://github.com/Lord-Kamina/SwiftDefaultApps you can achieve it!


Before; before, open file with xcode

After; after, open file with vs code


Instructions;

  • Step 1: After installing the app, go to System preferences > SwiftDefaultApps
  • Step 2: Go to the Uniform Type Identifiers tab and look for public data.
  • Step 3: Assign, under the Editor section, the desired editor.

look for public data

  • Step 4: Apply (the app is a little bit clumsy and sometimes it doesn't show the confirmation popup, if this is the case, just close the preference window, open it again and check that everything is ok!)
mayo
  • 3,845
  • 1
  • 32
  • 42
0

Since asking this question, I stumbled upon this MacOS system file: ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist

I've found that you can add your own dict entries into the LSHandlers array. For instance, I added the following entry to bind all public.data file types to my Sublime application:

<dict>
  <key>LSHandlerContentType</key>
  <string>public.data</string>
  <key>LSHandlerPreferredVersions</key>
  <dict>
    <key>LSHandlerRoleAll</key>
    <string>-</string>
  </dict>
  <key>LSHandlerRoleAll</key>
  <string>com.sublimetext.4</string>
</dict>
Taylor
  • 21
  • 3
-1
  1. Right click on a file where you want to change the default editor
  2. Choose Get Info (Or simply select the file and press CMD+I)
  3. Select the editor in the Open with section
  4. Click Change All..

Now all files of this type will be opened with the editor you selected.

Lucky
  • 319
  • 1
  • 6
  • Unfortunately, that won't work with files that don't have an extension (see original question) – Taylor Sep 13 '19 at 20:11