Articles index

New app: Stop The Mac App Store

January 12 2020 by Jeff Johnson
Support this blog: StopTheMadness, Link Unshortener, Underpass, PayPal.Me

Have you ever been annoyed that Mac App Store pages in Safari automatically open App Store app? Would you like to stop that from happening? Good news, now you can! I've just released a free open source Mac app called Stop The Mac App Store that allows you to stop Safari (and Safari Technology Preview) from opening the App Store app.

Safari screenshot

Stop The Mac App Store is a universal binary for Intel and Apple silicon Macs, and it requires macOS 11 Big Sur. If you're running macOS Mojave or Catalina, this feature was actually already included in my other app StopTheNews, so you should use the older version 2.2 of StopTheNews for macOS 10.14 and 10.15 compatibility. I decided to split the two features into two separate apps on Big Sur, for several reasons. First, the Mac App Store feature was somewhat hidden in StopTheNews and not well known, so user discovery is improved if there's a dedicated app. Second, not every user necessarily wants both the Mac App Store and Apple News features, but until now it was impossible to use just one. Finally, there's a technical reason why the combination was problematic on Big Sur, which I'll explain in the rest of this blog post. If you don't care about the technical details, then this is your cue to exit the blog post immediately and go download Stop The Mac App Store!

On macOS Mojave and Catalina, Safari opens Apple News URLs in the app that's registered as the default handler for the applenews URL scheme. Normally, that's the News app. StopTheNews works by registering itself as the the default handler for the applenews URL scheme instead of News app. However, this technique no longer works on macOS Big Sur, which started using "Universal Links" for Apple News. Even though StopTheNews is still registered as the the default handler for the applenews URL scheme, Safari nonetheless opens Apple News URLs in the News app, because there's an Apple App Site Association File associated with Apple News.

Fortunately, I discovered a technique to "fool" Universal Links: create a "fake" app. I had previously used this technique to create my StopTheTwitter app, and it turns out that the same technique works on Big Sur with Apple News! StopTheNews for Big Sur poses as the News app by using the same bundle identifier as the News app, com.apple.news, and with a little trickery StopTheNews "wins" over News app when macOS decides which app to use to open a URL.

This works fine while StopTheNews is installed, but fellow developer Neil Sardesai informed me of a problem: if you uninstalled StopTheNews on Big Sur, then Mac App Store links started opening in the News app! The News app doesn't know how to handle Mac App Store links, and it's a very bad experience. Why did this happen? Because StopTheNews also registered itself as the default handler for the macappstore URL scheme in order to override the App Store app, but macOS identifies the default URL scheme handler by its bundle identifier. This was not an issue back when StopTheNews had the bundle identifier com.lapcatsoftware.StopTheNews before Big Sur. If the app with the bundle identifier com.lapcatsoftware.StopTheNews is the default handler for the macappstore URL scheme, but macOS can't find the app because you uninstalled it, then macOS will fall back to opening Mac App Store links in App Store app, which also handles the macappstore URL scheme. On the other hand, after StopTheNews adopted the com.apple.news bundle identifier, uninstalling StopTheNews did not make macOS fall back to opening Mac App Store links in App Store app, because there was still an app with the com.apple.news bundle identifier to be found on your system, namely, the News app.

Unfortunately, I did not anticipate this side effect when I released StopTheNews version 3.0 for Big Sur. The solution, though, was obvious: create a separate app with a unique bundle identifier to handle the macappstore URL scheme. This app is the new Stop The Mac App Store, which uses com.lapcatsoftware.StopTheMacAppStore as its bundle identifier. At the same time, I've released a new version of StopTheNews that still uses the com.apple.news bundle identifier but no longer registers itself as the default handle for the macappstore URL scheme. StopTheNews 4.0 is also a universal binary now.

One last technical tidbit, "one more thing". The confirmation dialog "Do you want to allow this page to open Stop The Mac App Store.app" is not created by Stop The Mac App Store, it's created by Safari. As I noted in an older blog post, Safari now requires user confirmation every time it opens an app that handles a custom URL scheme. The reason you don't see the confirmation dialog for App Store app is that Apple exempts some of its own apps from the new requirement. (Do as we say, not as we do.) Besides App Store app, I'm aware of exemptions for News app and Radar app (Apple's internal bug reporting tool), among others. Third-party apps of course are not exempt. You may have noticed the dialog whenever you click a Zoom link, for example. Ironically, Stop The Mac App Store relies on this "annoyance" as a feature. You can't cancel App Store app from opening, but you can cancel Stop The Mac App Store from opening, because my third-party app isn't granted a special exemption by Safari. My favorite kind of hack is standing Apple technology on its head! By the way, if you want a way to avoid those confirmation dialogs for third-party apps, my Safari extension StopTheMadness can do this.

Support this blog: StopTheMadness, Link Unshortener, Underpass, PayPal.Me

Articles index