4

I'm working on a document based application in Cocoa, the file is a bundle type (a folder which the Finder shows as a single file much like an application.)

I had everything working perfectly but then I made the mistake of adding a reverse domain name type identifier to my file's type in my info.plist (something I later learned Apple explicitly warn not to do here). Well, this immediately broke my file type, documents from my application only look like folders in the Finder now, so there is no 'open' or 'open with' option on any of them and the data inside is exposed.

Removing the MIME identifier from my plist and rebuilding does not repair the registration of the files type in launch services, not even after explicitly pointing LSRefresh at the build (it is only a debug build).

Please, can any of you terminal gurus tell me how to remove the file type from the Launch Services database? I'm sure that if I can do that then everything will restore when I next launch the app.

2
+25

Registering and unregistering apps and document types is done with:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister

To get help with the command simply use the h option.:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -h

In your case I would try to use the unregister option:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u <path to bundle>

Depending on your app/bundle you may have to prepend a sudo and/or reboot afterwards.


Another step is to completely rebuild the launch services database:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

and/or installing RCDefault.app and trying to remove the MIME/bundle/whatever - which is possible sometimes.

  • Hi thanks for your answer. I tried it every way I can think of but unfortunately this mime type persists. I think maybe I need to reinstall OS X. Thanks anyway – Jef Apr 28 '17 at 11:06

You must log in to answer this question.

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