tauri-docs icon indicating copy to clipboard operation
tauri-docs copied to clipboard

[docs] `tauri build --bundles dmg` can works?

Open miro-ring opened this issue 11 months ago • 6 comments

https://v2.tauri.app/distribute/dmg/ This document says yarn tauri build --bundles dmg can works.

https://v2.tauri.app/reference/cli/#build But in this document, dmg option is not valid.

How to bundle dmg which targets universal-apple-darwin?

miro-ring avatar Jan 03 '25 08:01 miro-ring

Yes it does work. The linked reference is auto generated on a Linux system and the help output is platform specific.

FabianLars avatar Jan 03 '25 09:01 FabianLars

Since you opened another issue, here's how to build a universal app/dmg:

  1. Run rustup target add aarch64-apple-darwin x86_64-apple-darwin
  2. Run npm run tauri build -- --target universal-apple-darwin
    • Add -b dmg if you didn't configure tauri.conf.json to include all targets.

Note that thanks to apple this (currently) only works on macOS machines.

FabianLars avatar Jan 03 '25 12:01 FabianLars

@FabianLars Thanks! I will try this command.

miro-ring avatar Jan 03 '25 15:01 miro-ring

i'll reopen this because we really need to add back those instructions to the new docs (we've had it in v1)

FabianLars avatar Jan 03 '25 15:01 FabianLars

@FabianLars I tried your solution. When running the project locally, everything works fine, but in the CI environment, I keep encountering the error

warning: [email protected]: cc: error: unrecognized command-line option '-arch'
warning: [email protected]: cc: error: unrecognized command-line option '-mmacosx-version-min=10.13'
error: failed to run custom build command for `objc-sys v0.3.5`

How can I resolve this issue?

This is my CI script.

    execute:
      - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
      - export PATH="$HOME/.cargo/bin:$PATH"
      - rustup target add aarch64-apple-darwin x86_64-apple-darwin
      - apt-get update
      - apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf jq
      - VERSION=$(jq -r '.version' package.json)
      - yarn
      - cargo install tauri-cli --git https://github.com/tauri-apps/tauri
      - yarn tauri build -- --target universal-apple-darwin

Error occurs in yarn tauri build -- --target universal-apple-darwin

miro-ring avatar Jan 03 '25 16:01 miro-ring

Like I said above, you can only build macos apps on a macos machine. Your CI seems to be running on Linux though.

FabianLars avatar Jan 03 '25 17:01 FabianLars