Too strict AND too lenient?

Environment: MacBookPro running macOS Mojave (10.14.6), with BBEdit 12.6.7 available.

Situation: An HTML file has been downloaded from a Website to my desktop via Firefox 71.0. Finder sees it (via File > Get Info) as an “HTML document,” to be opened with my Firefox (my default browser).

So what can be done with this file?

  1. If I double-click it “as-is,” it opens in Firefox, as expected. But that’s not what I want to do with it; and as we’ll see below, that is also “too lenient.”

  2. If I use Finder to do “File > Open With > BBEdit,” it opens in BBEdit as expected. That’s fine, but awkward.

  3. Since I don’t want to have remember to use that tedious method in future work on this file, I use Finder (via File > Get Info) to change the file to open with BBEdit, expecting to be able to double-click to open. But surprise! When I double-click it, instead of the file opening I get this nasty message:
    00%20AM

BUT the file is NOT an application, and I was not trying to open it as an application! Finder is being much too strict in not allowing the file to be opened. And if this behavior is somehow correct, then the behavior seen in steps 1 and 2 above is a security violation (i.e., too lenient).

  1. What is even worse is that “File > Open With > BBEdit,” which worked perfectly well in step 2 (above), now doesn’t work – it produces the same nasty message!

  2. If I use BBEdit, I can do “File > Open…”, select the file, and it will open nicely, without interference from an over-zealous Finder. If I then do “File > Save As…” to replace the original file with a new one of the same name, that doesn’t solve the problem. But if I do “File > Save As…” with a new name, then delete the original download, then rename the new file to the original name, I end up with something that looks just like the original file but can be opened in BBEdit via a double-click. What a pain!

What’s going on here?
Why does Finder (sometimes?) act as if opening a downloaded document file with an app is the same as opening a downloaded app?
Or, why does Finder treat a downloaded Firefox document differently from a downloaded BBEdit document?
Is this reasonable behavior, or not?

Carl S Zimmerman

I may not be able to answer all of your questions but I offer what I can. When you get that dialog box about an “unidentified developer” you can open items like that by right-clicking on the item in question and choosing “open.” That will let you bypass Gatekeeper a single time to open the item. It is odd that it is being identified as an application but I do not have an answer as to why that happened.

As far as having your html document open in BBEdit always it is possible your LaunchServices database has become corrupted. There are a few things you can try for that. One is to right-click on the item and when you get the window with options to open the item then press the Option Key. That will then change the “Open” option to “Always Open With.” That might correct things so as to have BBEdit always open the item.

Another is to rebuild the LaunchServices database. You can use a utility such as OnyX:

OnyX at Titanium Software

However, there are a lot of options in utilities such as OnyX and a user needs to read the documentation and be careful of what it is asked to do.

Or you can try this Terminal command to rebuild the LaunchServices database. Copy all of the text and paste it into a Terminal window and then press the Return key:

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

When the regular prompt returns to the Terminal window then type:

killall Finder

and press the Return key. You can then exit Terminal and your LaunchServices database will be reset.

Documents identified as “BBEdit text document” open properly in all circumstances except the one I described in step 3. For that reason, I initially doubted the possibility of LaunchServices being corrupted.

However, I tried a variation on your suggestion to right-click (=control-click) on the item. I chose Open With and selected BBEdit. That gave me a warning message so similar in format to the previous one that I dismissed it before realizing that instead of an absolute prohibition it was offering me an option to “open anyway.” Apparently that is what I actually did, because not only did the file then open in BBEdit, but further experimentation could no longer reproduce the original problem. So the “open anyway” option also fixed whatever tiny corruption there might have been.

So thank you, Gordon!

Carl