<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ByteDuster</title>
    <description>The latest articles on DEV Community by ByteDuster (@byteduster).</description>
    <link>https://dev.to/byteduster</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4256364%2F1920455e-f2a8-4664-8208-8e311ba0d7e4.png</url>
      <title>DEV Community: ByteDuster</title>
      <link>https://dev.to/byteduster</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/byteduster"/>
    <language>en</language>
    <item>
      <title>One Tauri 2 codebase, two Mac apps: a notarized DMG and a Mac App Store build</title>
      <dc:creator>ByteDuster</dc:creator>
      <pubDate>Fri, 20 Nov 2026 21:18:27 +0000</pubDate>
      <link>https://dev.to/byteduster/one-tauri-2-codebase-two-mac-apps-a-notarized-dmg-and-a-mac-app-store-build-j3b</link>
      <guid>https://dev.to/byteduster/one-tauri-2-codebase-two-mac-apps-a-notarized-dmg-and-a-mac-app-store-build-j3b</guid>
      <description>&lt;p&gt;I build &lt;a href="https://byteduster.com/?ref=devto" rel="noopener noreferrer"&gt;ByteDuster&lt;/a&gt;, a Mac cleaner made with Tauri 2, Svelte 5 and Rust. It explains every file before it goes and moves everything to the Trash first, so one click can undo a cleanup.&lt;/p&gt;

&lt;p&gt;It is built two ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Direct&lt;/strong&gt;: a DMG from the website. It is signed with Developer ID, notarized and updates itself. This one is live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mac App Store&lt;/strong&gt;: sandboxed, with purchases through StoreKit 2 and no self-updater. This one is in App Review as I write this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both come from the same repository. This is how that is set up, and what Apple's review taught me along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two editions as Cargo features
&lt;/h2&gt;

&lt;p&gt;The edition is decided at compile time, not at runtime:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="k"&gt;[features]&lt;/span&gt;
&lt;span class="na"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"direct"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Website/DMG edition: Tauri's macOS private API (transparent widgets) and the self-updater.
&lt;/span&gt;&lt;span class="na"&gt;direct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tauri/macos-private-api"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dep:tauri-plugin-updater"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Mac App Store edition: sandboxed, StoreKit 2, no updater, no private API.
&lt;/span&gt;&lt;span class="na"&gt;app-store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;direct&lt;/code&gt; is the default, so &lt;code&gt;cargo test&lt;/code&gt;, &lt;code&gt;tauri dev&lt;/code&gt; and the normal release script all keep working unchanged. The App Store build is &lt;code&gt;--no-default-features --features app-store&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two &lt;code&gt;compile_error!&lt;/code&gt; lines make it impossible to build neither edition or both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cp"&gt;#[cfg(all(feature = "direct", feature = "app-store"))]&lt;/span&gt;
&lt;span class="nf"&gt;compile_error!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Build either the `direct` or the `app-store` edition, not both."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cp"&gt;#[cfg(not(any(feature = "direct", feature = "app-store")))]&lt;/span&gt;
&lt;span class="nf"&gt;compile_error!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"No distribution edition selected."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why a feature and not a runtime flag? App Review looks at the binary. Code the sandbox does not allow should not be in the binary at all, not merely hidden behind a setting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leaving commands out of the binary
&lt;/h2&gt;

&lt;p&gt;Some of what the Direct edition does cannot work in the App Sandbox: uninstalling other apps, ending other apps' processes, administrator prompts, Apple Events to Mail and browsers, the browser extension's native messaging. Those Tauri commands are registered only in the Direct build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tauri&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;generate_handler!&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="c1"&gt;// ...&lt;/span&gt;
    &lt;span class="cp"&gt;#[cfg(not(feature = "app-store"))]&lt;/span&gt;
    &lt;span class="n"&gt;updates&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;update_check&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="cp"&gt;#[cfg(not(feature = "app-store"))]&lt;/span&gt;
    &lt;span class="n"&gt;updates&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;update_install&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;smart_scan_cancel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;edition.rs&lt;/code&gt; keeps the list of excluded command names in one constant, &lt;code&gt;APP_STORE_EXCLUDED_COMMANDS&lt;/code&gt;. A unit test reads &lt;code&gt;lib.rs&lt;/code&gt; with &lt;code&gt;include_str!&lt;/code&gt; and fails if any command on that list is in the handler without the &lt;code&gt;#[cfg]&lt;/code&gt; line. The same module sends the interface a &lt;code&gt;Capabilities&lt;/code&gt; struct: &lt;code&gt;can_uninstall_apps&lt;/code&gt;, &lt;code&gt;can_control_processes&lt;/code&gt;, &lt;code&gt;supports_self_updates&lt;/code&gt; and so on. Every flag follows from what is compiled in. The Svelte side builds its screens from that struct, so the App Store edition never shows a button that cannot work.&lt;/p&gt;

&lt;h2&gt;
  
  
  A second Tauri config
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tauri.appstore.conf.json&lt;/code&gt; is merged on top of the normal config with &lt;code&gt;--config&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;its own bundle identifier: the App Store build is a separate app (&lt;code&gt;com.byteduster.mac.appstore&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"plugins": { "updater": null }&lt;/code&gt;: the store does the updating;&lt;/li&gt;
&lt;li&gt;its own &lt;code&gt;Info.plist&lt;/code&gt; and a &lt;code&gt;PrivacyInfo.xcprivacy&lt;/code&gt; privacy manifest;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;beforeBuildCommand&lt;/code&gt; sets &lt;code&gt;VITE_BYTEDUSTER_EDITION=appstore&lt;/code&gt;, so the front end knows the edition at build time too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The build script gives the App Store edition its own &lt;code&gt;CARGO_TARGET_DIR&lt;/code&gt;. Both editions can then be built without overwriting each other's output.&lt;/p&gt;

&lt;p&gt;One surprise: Tauri merges &lt;code&gt;src-tauri/Info.plist&lt;/code&gt;, the Direct edition's, into every build. My script deletes the Direct-only keys afterwards with &lt;code&gt;PlistBuddy&lt;/code&gt;: URL handlers, document types, the Apple Events usage text and the folder usage texts.&lt;/p&gt;

&lt;h2&gt;
  
  
  StoreKit 2 from Rust: a small Swift static library
&lt;/h2&gt;

&lt;p&gt;StoreKit 2 is a Swift-only API. Rust cannot call it directly, so the App Store edition links a small Swift file, &lt;code&gt;native/AppStoreBridge.swift&lt;/code&gt;. &lt;code&gt;build.rs&lt;/code&gt; compiles it only when the feature is on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var_os&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"CARGO_FEATURE_APP_STORE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"CARGO_CFG_TARGET_OS"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_deref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"macos"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;build_app_store_bridge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// xcrun swiftc -emit-library -static ... -target arm64-apple-macos13.0&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then it links &lt;code&gt;StoreKit&lt;/code&gt;, &lt;code&gt;AppKit&lt;/code&gt; and &lt;code&gt;Foundation&lt;/code&gt;, and points the linker at the Swift runtime in &lt;code&gt;/usr/lib/swift&lt;/code&gt;. The minimum macOS here is 13, and the Swift runtime ships with the system.&lt;/p&gt;

&lt;p&gt;The bridge is a handful of C functions. Every answer is a JSON string, and asynchronous calls take a context pointer and a callback. It does two jobs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;StoreKit 2&lt;/strong&gt;: products, purchase, restore, transaction updates. Only transactions whose JWS signature StoreKit verified count as purchases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sandboxed file access&lt;/strong&gt;: &lt;code&gt;NSOpenPanel&lt;/code&gt;, security-scoped bookmarks, and moving files to the user's real Trash with &lt;code&gt;NSFileManager&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Direct edition never compiles this file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Entitlements: as few as possible
&lt;/h2&gt;

&lt;p&gt;The whole App Store entitlements file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;app-sandbox&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files.user-selected.read-write&lt;/code&gt;: folders the user picks in the open panel&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files.bookmarks.app-scope&lt;/code&gt;: keeps those picks across launches&lt;/li&gt;
&lt;li&gt;&lt;code&gt;files.downloads.read-write&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;network.client&lt;/code&gt;: outgoing connections only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ByteDuster also embeds a small helper binary. It is signed with exactly &lt;code&gt;app-sandbox&lt;/code&gt; + &lt;code&gt;inherit&lt;/code&gt;, which is what Apple requires for a helper that runs inside the app's sandbox. Signing goes inside out: the helper first, then the app, whose signature seals everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  An audit script that checks the built app
&lt;/h2&gt;

&lt;p&gt;Passing review starts with checking the artifact you upload, not the sources. &lt;code&gt;scripts/audit-appstore-macos.sh&lt;/code&gt; runs on the built &lt;code&gt;.app&lt;/code&gt; after every App Store build. It checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the signature and entitlements of every Mach-O file;&lt;/li&gt;
&lt;li&gt;that excluded command names do not appear in the binary;&lt;/li&gt;
&lt;li&gt;that debug-only switches did not reach the build;&lt;/li&gt;
&lt;li&gt;that files carry no extended attributes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It sorts findings into CRITICAL (the build fails), CONFIG, REVIEW and RUNTIME. It cannot promise approval, but it catches the boring mistakes before Apple does.&lt;/p&gt;

&lt;h2&gt;
  
  
  What review actually rejected
&lt;/h2&gt;

&lt;p&gt;Two rejections, neither about code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;ITMS-91109, extended attributes.&lt;/strong&gt; I downloaded the provisioning profile in a browser, so it carried &lt;code&gt;com.apple.quarantine&lt;/code&gt;. Embedded in the app, that was enough to reject the upload. The script now runs &lt;code&gt;xattr -cr&lt;/code&gt; on the bundle before signing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Terms of Use link.&lt;/strong&gt; An app with subscriptions needs a link to the EULA in its App Store description. Apple's standard EULA is fine; it just has to be there.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Direct edition
&lt;/h2&gt;

&lt;p&gt;The Direct edition keeps everything the sandbox forbids, plus Tauri's updater. The release script builds one universal app for Apple silicon and Intel, signs it with Developer ID and submits it with &lt;code&gt;xcrun notarytool submit --wait&lt;/code&gt;. It then packs a signed, notarized DMG and the signed update for installed copies. Licences are checked against my own small server, and payments go through Stripe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Was it worth it?
&lt;/h2&gt;

&lt;p&gt;Two editions cost a second config, a Swift file, an entitlements file and a few &lt;code&gt;#[cfg]&lt;/code&gt; lines. Feature flags keep the cost low: the shared code is most of the app, and nothing the sandbox forbids ever reaches the store binary.&lt;/p&gt;

&lt;p&gt;If you are shipping a Tauri app on macOS and have questions about any of this, ask in the comments. ByteDuster is free to scan: &lt;a href="https://byteduster.com/?ref=devto" rel="noopener noreferrer"&gt;byteduster.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>tauri</category>
      <category>rust</category>
      <category>macos</category>
      <category>appstore</category>
    </item>
  </channel>
</rss>
