"Open with" configuration gets screwed up unpredictably on El Capitan I've been having a problem on my El Capitan installation for a few months. At unpredictable times, the system "unlearns" the programs associated with certain file types.

For example, I double click a PDF in Finder, and it tries to open it with Microsoft Word (which of course complains it is unable to open it). To fix, I have to [right-click -> "Open With" -> "Other..." ] a PDF file, go find Preview (which by the way is not even in the "Recommended Applications") and select "Always Open With", and then the problem goes away for some time.

For a while I thought this problem was limited to PDFs, and was somehow a bug caused by Microsoft Office.

However, just now I had the same problem, but the system defaulted to iTerm for opening hyperlinks! So when I clicked on a link inside an email, it caused an empty iTerm to be opened... To fix I had to create a shortcut to a webpage, then [right-click -> "Open With" -> "Other..." ] and select Firefox.

Would be glad for any help to restore sanity, or at least to understand what is going on!
I would suggest you rebuild the LaunchServices database, the mechanism which matches files to the apps which open them.

There are several sites which explain the process, here and here, for example.

In essence, you need to copy and paste the following command in Terminal after making a full backup with Time Machine:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain u -domain s -domain l -v



If you are leery of using Terminal, you can use the free app Onyx to rebuild the index. Onyx has many other abilities in addition to rebuilding the LaunchServices database.

Disclaimer: I have no financial or other stake in Titanium Sofware, the developer of Onyx.