Jeff Johnson (My apps, PayPal.Me, Mastodon)

Feedback Assistant Boycott

Stop The Mac App Store improved for Sonoma and Ventura

April 3 2024

The App Store app on macOS is the default handler of URLs with the macappstore: scheme. App Store preview web pages automatically open the App Store app by setting the location of an HTML <iframe> element to a macappstore: URL. My free open source app Stop The Mac App Store registers itself as the default macOS handler for the macappstore: scheme, thereby preventing Safari and Safari Technology Preview from automatically opening those URLs in App Store. If you click Cancel or press the escape key, the App Store app won't open.

Do you want to allow this website to open Stop The Mac App Store.app?

I've discovered that macOS Ventura and Sonoma changed how Safari handles App Store links, bypassing Stop The Mac App Store in some cases. Fortunately, I've also discovered a solution to the problem. In this blog post I'll discuss both the problem and the solution. As a bit of a spoiler, let me first deflate the conspiracy theories: Apple wasn't specifically targeting Stop The Mac App Store, which is too obscure to be noticed by the corporate giant. My app never lost the ability to become the default handler of the macappstore: URL scheme. Rather, it seems that macOS Ventura started treating App Store URLs as universal links:

With universal links, users open your app when they click links to your website within Safari and WKWebView

If you paste an App Store URL such as https://apps.apple.com/app/stopthemadness-pro/id6471380298 (for my own app StopTheMadness Pro) into Safari's address bar, then Stop The Mac App Store continues to work as before. However, if you click an App Store link in a web page, the behavior on macOS Ventura and later differs from the behavior on Monterey and earlier. Strangely, the specific behavior on Ventura and Sonoma depends on whether the link is in a private window or a non-private window. If you click an App Store link in a non-private window, Safari directly opens the link in the App Store app, entirely bypassing Stop The Mac App Store, not even loading the App Store preview web page.

On the other hand, if you click an App Store link in a private window, Safari asks your permission to open the link in the App Store app. Note carefully that it's not asking permission to open the link in Stop The Mac App Store! In this case it's also bypassing Stop The Mac App Store. Also note that Safari hasn't yet loaded the App Store preview page; instead, Safari gives special treatment to https://apps.apple.com links.

Do you want to allow this website to open App Store?

You actually have to cancel twice for some reason, and then Safari loads the App Store preview page.

Open in the App Store app

Notice the banner at the top that says "Open in the App Store app" with an Open button. That's not actually part of the web page: it's Safari's native interface for a universal link. I've blogged about universal links in the past, with regard to the Twitter app for Mac. My "insanely devious" idea to stop universal links in that case was to create a fake Twitter app called StopTheTwitter with the same bundle identifier but a higher version number than the real Twitter app, which tricked macOS into thinking that StopTheTwitter was the real Twitter app.

The question is, would my insanely devious idea work again, this time with the App Store app? The answer is… yes! The latest version of Stop The Mac App Store solves the problem with universal links on Ventura and Sonoma, restoring the previous desired behavior for App Store preview web pages. I call it version 2.0, but it's actually CFBundleShortVersionString 9999.9, arbitrarily much higher than the 3.0 version of the App Store app.

By the way, last year I explained how you could stop universal links with third-party Mac apps by using Little Snitch to block connections from the /usr/libexec/swcd process (Shared Web Credentials Daemon). This trick doesn't work with the first-party App Store app, though, because it appears that App Store doesn't use an Apple App Site Association File https://apps.apple.com/.well-known/apple-app-site-association on the web. Instead, the universal links behavior is built into the operating system, which is why you need to use Stop The Mac App Store.

Feedback Assistant Boycott

Jeff Johnson (My apps, PayPal.Me, Mastodon)