Tauri macOS codesign: code has no resources
My Tauri app had no icon and failed codesign -v with "code has no resources but signature indicates they must be present". The icon fixed only the icon.
Contents
I am writing a desktop tool in Tauri 2 — a game builder, macOS first. For
weeks I ran it straight out of the build tree and it worked. The first time I copied it into
/Applications, two things were wrong. The app had no icon of its own, and codesign -v
refused the bundle:
$ codesign -v /Applications/MyApp.app
/Applications/MyApp.app: code has no resources but signature indicates they must be present
They looked like one problem, a bundle with nothing in it, and turned out to be two. Adding the icon did not touch the signature. And before I got to either, the build was compiling with the wrong Rust.
Everything here is a local build on an Apple Silicon Mac, ad-hoc signed. I have not set up Developer ID signing or notarization, so nothing below is about that.
Homebrew's rustc ignores rust-toolchain.toml
The project pins its compiler in src-tauri/rust-toolchain.toml, and CI builds with that
version. Before the first local build I checked what my shell would actually use:
$ rustc --version
rustc 1.86.0 (05f9846f8 2025-03-31) (Homebrew)
$ cat src-tauri/rust-toolchain.toml
[toolchain]
channel = "1.89.0"
profile = "minimal"
rustup was installed, and it already had 1.89.0:
$ rustup toolchain list
stable-aarch64-apple-darwin (active, default)
1.89.0-aarch64-apple-darwin
$ which -a rustc
/opt/homebrew/bin/rustc
~/.cargo/bin/rustc
That second listing is the whole story. rust-toolchain.toml is read by rustup's proxies,
the rustc and cargo in ~/.cargo/bin. Homebrew's rustc is a plain compiler that knows
nothing about the file, and it sat first on my PATH, so the pin was ignored without a word.
Any build from that shell would have used 1.86, not the compiler CI uses.
Putting the shim first fixes it:
$ PATH="$HOME/.cargo/bin:$PATH" rustc --version
rustc 1.89.0 (29483883e 2025-08-04)
I build with PATH="$HOME/.cargo/bin:$PATH" pnpm tauri:build now. Uninstalling Homebrew's
Rust would also work. I haven't, so the prefix stays.
The copy was not the problem
My first install was rm -rf of the old copy, then cp -R of the new bundle into
/Applications, then codesign -v. When that printed the error above, the obvious suspect
was cp -R, since ditto is the usual advice for copying app bundles. So I reinstalled with
ditto:
$ ditto build/MyApp.app /Applications/MyApp.app
$ codesign -v --verbose=2 /Applications/MyApp.app
/Applications/MyApp.app: code has no resources but signature indicates they must be present
Same line. Then I asked the bundle Tauri had just produced, before any copy:
$ codesign -v --verbose=2 build/MyApp.app
build/MyApp.app: code has no resources but signature indicates they must be present
$ ls Contents/
Info.plist
MacOS
The copy had nothing to do with it. The bundle failed verification the moment it was built,
and it held two entries: Info.plist and the binary. No Resources folder, and no
_CodeSignature folder either.
I still install with ditto. But I can't claim cp -R broke anything here, because the
same error came out with both tools and out of the build tree as well.
Why the app had no icon
An empty Resources folder meant no icon file, so I looked at the config. tauri.conf.json
had a bundle block with no icon key, and git log -S'"icon"' on that file came back
empty across every branch. It had never had one.
There was an icons/icon.png in the repo: a 427-byte, 128×128 PNG. It had been added
earlier to fix a compile error in CI, where Tauri's generate_context!() macro stopped the
build with:
failed to open icon .../src-tauri/icons/icon.png:
No such file or directory (os error 2)
That stub was enough for the macro and nothing else. The macro wants a file at that path. The
bundler wants bundle.icon, and nobody had ever set it. Next to the stub sat an unused
512×512 icon-source.svg, so I generated a real set from it:
npx tauri icon src-tauri/icons/icon-source.svg
That writes far more than a macOS app needs: Android and iOS folders and the Windows Store
Square*Logo.png files as well. This project builds none of those targets, so I deleted them
and pointed the config at what remained:
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/64x64.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
}
After a rebuild, the installed bundle had Contents/Resources/icon.icns at 84,608 bytes.
file reported Mac OS X icon, 84608 bytes, "ic08" type, sips reported 1024×1024, and
Info.plist now carried CFBundleIconFile = icon.icns. For the first time, Finder and the
Dock had an icon to show.
The signature the linker wrote
I expected the codesign error to be gone, since the bundle finally had resources in it. It wasn't:
$ codesign -v --verbose=2 /Applications/MyApp.app
/Applications/MyApp.app: code has no resources but signature indicates they must be present
Word for word the same, with Resources/icon.icns sitting right there. I had dumped the
signature details on the very first build, and nothing about signing had changed since:
$ codesign -dv build/MyApp.app
Format=app bundle with Mach-O thin (arm64)
CodeDirectory v=20400 size=67880 flags=0x20002(adhoc,linker-signed) hashes=2117+0 location=embedded
linker-signed. On Apple Silicon the linker puts an ad-hoc signature on the binaries it
writes, because arm64 macOS will not run unsigned code. That signature belongs to the Mach-O
file, created at link time, before there is any bundle around it. Nothing had ever signed the
bundle itself, which is why there was no _CodeSignature/CodeResources sealing what is in
Resources/. So the icon did not cause the error, and it did not fix it. The error was there
before the icon and after it, in identical words.
I haven't dug into exactly which part of the binary's signature makes codesign say
resources "must be present". What I can show is the before and after, which is below.
First, a one-off check on a throwaway copy of the app, not the install:
$ codesign --force --deep --sign - probe.app
probe.app: replacing existing signature
$ codesign -v --verbose=2 probe.app
probe.app: valid on disk
probe.app: satisfies its Designated Requirement
--sign - means an ad-hoc identity: no certificate, just a seal that makes the bundle
consistent with itself. That proved the bundle was fine and only its signature was stale. It
was also the wrong place to fix it, because a command I run by hand after a build is a
command I will forget.
The fix is one line of config
Tauri can sign the finished bundle itself. With a signing identity of "-" it does an
ad-hoc signature, the same as the command above, but as part of tauri build:
"bundle": {
"macOS": { "signingIdentity": "-" }
}
My release pipeline already set this for its internal macOS builds, as an overlay on top of
the base config. Only the base config, the one a plain local tauri build reads, was
missing it. Adding it there was the entire change. After a rebuild:
$ codesign --verify --deep --strict --verbose=2 build/MyApp.app
build/MyApp.app: valid on disk
build/MyApp.app: satisfies its Designated Requirement
$ codesign -dv build/MyApp.app 2>&1 | grep -E 'flags|Sealed'
CodeDirectory v=20500 size=17334 flags=0x10002(adhoc,runtime) hashes=535+3 location=embedded
Sealed Resources version=2 rules=13 files=1
linker-signed is gone, replaced by runtime (the hardened runtime flag), and there is now
a Sealed Resources line. One file sealed, in a bundle whose only
content besides the binary and Info.plist is the icon. --strict passes too, which is the
form my release pipeline checks.
This is still an ad-hoc signature. It makes the bundle consistent; it does not tell anyone else's Mac who made it. That is Developer ID signing and notarization, which I haven't done yet.
I kept the signing change out of the icon change on purpose, and the two landed a week apart. How an app gets signed is a decision someone will one day go looking for, and they won't look inside a commit titled "add the app icon".
The .dmg step, unexplained
One more failure, which I have not solved. On the build that verified the signature, the
last step of tauri build failed:
failed to bundle project: error running bundle_dmg.sh: `failed to run .../bundle/dmg/bundle_dmg.sh`
The .app had already been written by then and was unaffected. A week earlier, on the same
machine, the same step had produced a 2.8 MB .dmg without complaint. bundle_dmg.sh lays
out the disk image window by scripting Finder, so Finder automation is my first suspect. I
haven't tested that, so treat it as a guess. If you only need the app locally, it doesn't
matter: install the .app from bundle/macos/ and ignore the image.
What I would check first next time
which -a rustcbefore the first build on a new machine. If anything other than~/.cargo/bincomes first,rust-toolchain.tomlis decoration.ls Contents/on the built bundle. A Tauri app with noResourcesfolder has no icon, and a missingbundle.iconintauri.conf.jsonis the reason.codesign -dvand look at the flags.linker-signedmeans nothing has signed the bundle, only the binary inside it. For me that came withcode has no resources but signature indicates they must be present. Setbundle.macOS.signingIdentityto"-"for local builds.- Verify the bundle in the build tree before blaming the install. I spent my first theory on
cp -R, and one morecodesign -vagainst the original would have saved it.
The app had launched fine the whole time. That is what let all of this sit there: running a
bundle checks almost nothing about it, the same way
a check can pass while testing nothing.
Installing it, and asking codesign about it, was the first real look anyone had taken.