Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS - App is signed, but getting "The application "App.app" can't be opened" #9738

Open
Mehdi-Hp opened this issue May 10, 2024 · 5 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@Mehdi-Hp
Copy link

Mehdi-Hp commented May 10, 2024

Describe the bug

I'm building for MacOS aarch64, everything seems to work fine. You can see the last lines of build command's log below, which seems to be successful.
But when I try to run the app, I get the following alert error:

CleanShot 2024-05-10 at 13 58 16@2x

  • If I run codesign --force --deep --sign H1ZJCH8WC4 /Applications/App.app, Then it works and I can open the App!
  • It was already working, like yesterday. It just got to this state and can't figure out what's wrong.
  • I made a new project with pnpm create tauri-app --beta and couldn't reproduce my problem. Then, I replaced my files into the new project, And same problem.

I wonder If there's any other way to debug this beside moving my files into a brand new project one-by-one and hit build over and over.

Update: Got one step further. It works if I remove "entitlements": "info.plist" from bundle.macOS. Here's the content of info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>CFBundleDocumentTypes</key>
		<array>
			<dict>
				<key>CFBundleTypeExtensions</key>
				<array>
					<string>myapp</string>
				</array>
				<key>CFBundleTypeIconFile</key>
				<string>icons/document.icns</string>
				<key>CFBundleTypeName</key>
				<string>App Custom File</string>
				<key>CFBundleTypeRole</key>
				<string>Viewer</string>
				<key>LSHandlerRank</key>
				<string>Owner</string>
				<key>LSTypeIsPackage</key>
				<string>YES</string>
			</dict>
		</array>
	</dict>
</plist>

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.4.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
    ✔ cargo: 1.78.0
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (overridden by '/.../rust-toolchain.toml')
    - node: 22.1.0
    - pnpm: 9.1.0
    - npm: 10.7.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.17
    - tauri-build [RUST]: 2.0.0-beta.14
    - wry [RUST]: 0.39.3
    - tao [RUST]: 0.27.0
    - tauri-cli [RUST]: 2.0.0-beta.11
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.11

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../skin/dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/probe2.ll
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/probe3.ll
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/probe7.ll
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/stderr
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/output
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/root-output
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/invoked.timestamp
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app/Contents/MacOS/App
    Info using entitlements file at info.plist
    Signing /Users/.../target/release/bundle/macos/App.app
    Info using entitlements file at info.plist
    Warn skipping app notarization, no APPLE_ID & APPLE_PASSWORD & APPLE_TEAM_ID or APPLE_API_KEY & APPLE_API_ISSUER & APPLE_API_KEY_PATH environment variables found
    Bundling App_0.0.2_aarch64.dmg (/Users/.../target/release/bundle/dmg/App_0.0.2_aarch64.dmg)
    Running bundle_dmg.sh
    Signing with identity "Apple Development: Created via API (H1ZJCH8WC4)"
    Info Signing app bundle...
    Signing /Users/.../target/release/bundle/dmg/App_0.0.2_aarch64.dmg
    Info using entitlements file at info.plist
    Bundling /Users/.../target/release/bundle/macos/App.app.tar.gz (/Users/.../target/release/bundle/macos/App.app.tar.gz)
    Cleaning /Users/.../target/release/bundle/macos/App.app
    Finished 1 bundle at:
        /Users/.../target/release/bundle/dmg/App_0.0.2_aarch64.dmg
        /Users/.../target/release/bundle/macos/App.app.tar.gz (updater)

Password:
Deriving a key from the password and decrypting the secret key... done
    Finished 1 updater signature at:
        /Users/.../target/release/bundle/macos/App.app.tar.gz.sig
@Mehdi-Hp Mehdi-Hp added status: needs triage This issue needs to triage, applied to new issues type: bug labels May 10, 2024
@Mehdi-Hp
Copy link
Author

Fixed when I removed "entitlements": "info.plist" from bundle.macOS. Tauri is still including info.plist automatically. Though, this is still a bug. I'm not sure if I should close this issue.

@ollyde
Copy link

ollyde commented May 23, 2024

Also facing this issue, but we can't remove entitlements as we have somethings we need there in both files.

@Mehdi-Hp
Copy link
Author

@ollyde The default value of entitlements is indeed info.plist. I'm not sure what the underlying bug is, but I've removed it in tauri config, and it's still using my entitlements file.

@FabianLars
Copy link
Member

Info.plist is not an entitlements file, but more like a list of general app info, so it's pretty much expected that using it as an entitlements file will cause problems. The main problem is basically related to what you wrote yourself:

If I run codesign --force --deep --sign H1ZJCH8WC4 /Applications/App.app, Then it works and I can open the App!

Tauri's cli will automatically include entitlements here, so if you specify Info.plist as one, it will run

codesign --entitlements Info.plist --force --deep --sign H1ZJCH8WC4 /Applications/App.app

and codesign seems to not properly validate the entitlements files here and just mindlessly applies them.

So, OP's issue is wontfix though i guess we should document this somewhere - i think we never mention the Info.plist file anywhere right now...

For @ollyde: Can you share the error logs and the contents of the relevant files?

@jafioti
Copy link

jafioti commented May 28, 2024

@FabianLars I'm facing this same problem too, it seems like if I don't include the explicit "entitlements": "info.plist" in the tauri conf, it builds, signs and notarizes without the key line "Info using entitlements file at info.plist", which builds, installs, and opens, but since the permissions weren't included, we cannot access the microphone.

Here's the info.plist file we use:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSMicrophoneUsageDescription</key>
	<string>Request microphone access for voice input</string>
</dict>
</plist>

When I do include the "entitlements": "info.plist" line, it does print "Info using entitlements file at info.plist" at signing time, but when I go to open the app once installed, I get the "The application can't be opend" error.

What is the recommended way to request microphone permissions? Is it even a plist file or another way?

btw I'm using tauri v2.0.0-beta.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

4 participants