Skip to content

VSCode forces file type associations on macos #214371

Open
@ibash

Description

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.89.1
  • OS Version: macOS 14.5

Steps to Reproduce:

  1. Install VSCode on macos

Expected:
File type associations are opt-in

Actual:
All code files now open with vscode

This is a continuation of #8687 and #51252, but those issues were auto-locked, so continuing the discussion here.

The current recommendation in those issues is to uninstall VSCode.
That's not a great solution but appears to be the only solution.

I'm filing this issue because I found another workaround and wanted to share with other users: manually editing the Info.plist to remove CFBundleDocumentTypes / CFBundleTypeExtensions.

In short:

  1. Make a backup

    cp /Applications/Visual\ Studio\ Code.app/Contents/Info.plist /Applications/Visual\ Studio\ Code.app/Contents/Info.plist.backup
  2. Edit Info.plist

    vim /Applications/Visual\ Studio\ Code.app/Contents/Info.plist
  3. Remove all or specific CFBundleTypeExtensions entries
    For deleting the entries remove everything between two dict tags, e.g. delete this to remove the .h association

    <dict>
      <key>CFBundleTypeExtensions</key>
      <array>
        <string>h</string>
      </array>
      <key>CFBundleTypeIconFile</key>
      <string>c.icns</string>
      <key>CFBundleTypeName</key>
      <string>C header file</string>
      <key>CFBundleTypeOSTypes</key>
      <array>
        <string>TEXT</string>
        <string>utxt</string>
        <string>TUTX</string>
        <string>****</string>
      </array>
      <key>CFBundleTypeRole</key>
      <string>Editor</string>
    </dict>
  4. Save the updated Info.plist

  5. Resign the application so you can open it

    codesign --force --deep --sign - /Applications/Visual\ Studio\ Code.app
  6. Force launch services to re-register the application

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -f /Applications/Visual\ Studio\ Code.app

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

install-updateVS Code installation and upgrade system issuesmacosIssues with VS Code on MAC/OS Xunder-discussionIssue is under discussion for relevance, priority, approach

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions