tauri: When running `tauri build`, `bundle_dmg.sh` errors `fails to bundle project`
Edit: the .dmg files are actually created and function correctly. You can find them in ./target/release/bundle/macos
Describe the bug
When running tauri build, bundle_dmg.sh errors fails to bundle project.
Looking at the error log below, the issue seems to stem from an Apple script not being authorized: execution error: Not authorised to send Apple events to Finder. (-1743)
I tried restarting, upgrading rustc, and running sudo tauri build - didn’t help.
Interestingly, tauri dev does work.
To Reproduce
git clone git@github.com:joepio/atomic-data-rust.gittauri build
Platform and Versions (required):
Operating System - Mac OS, version 12.0.1 X64
Node.js environment
Node.js - 16.9.1
@tauri-apps/cli - 1.0.0-beta.10
@tauri-apps/api - Not installed
Global packages
npm - 7.21.1
yarn - 1.22.17
Rust environment
rustc - 1.57.0
cargo - 1.57.0
App directory structure
/target
/server
/cli
/.github
/src-tauri
/lib
/.git
/.vscode
App
tauri.rs - 1.0.0-beta.8 (no lockfile)
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - ../server/static
devPath - ../server/static/tauri-splashscreen.html
package.json not found
Additional context
Add any other context about the problem here.
Stack Trace
+ WINX=10
+ WINY=60
+ WINW=500
+ WINH=350
+ ICON_SIZE=128
+ TEXT_SIZE=16
+ FORMAT=UDZO
+ ADD_FILE_SOURCES=()
+ ADD_FILE_TARGETS=()
+ IMAGEKEY=
+ HDIUTIL_VERBOSITY=
+ SANDBOX_SAFE=0
+ SKIP_JENKINS=0
+ MAXIMUM_UNMOUNTING_ATTEMPTS=3
+ POSITION_CLAUSE=
+ HIDING_CLAUSE=
+ [[ - = \- ]]
+ case $1 in
+ VOLUME_NAME='Atomic Server'
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ - = \- ]]
+ case $1 in
+ POSITION_CLAUSE='set position of item "Atomic Server" to {180, 170}
'
+ shift
+ shift
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ - = \- ]]
+ case $1 in
+ APPLICATION_LINK=480
+ APPLICATION_CLAUSE='set position of item "Applications" to {480, 170}
'
+ shift
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ - = \- ]]
+ case $1 in
+ WINW=660
+ WINH=400
+ shift
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ - = \- ]]
+ case $1 in
+ HIDING_CLAUSE='set the extension hidden of item "Atomic Server.app" to true
'
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ - = \- ]]
+ case $1 in
+ VOLUME_ICON_FILE=/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/icon.icns
+ shift
+ shift
+ case $FORMAT in
+ IMAGEKEY='-imagekey zlib-level=9'
+ [[ A = \- ]]
+ [[ -z Atomic Server.app ]]
+++ dirname /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/bundle_dmg.sh
++ cd /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg
++ pwd
+ SCRIPT_DIR=/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg
+ DMG_PATH='Atomic Server_0.28.2_aarch64.dmg'
++ dirname 'Atomic Server_0.28.2_aarch64.dmg'
+ DMG_DIRNAME=.
++ cd .
++ pwd
+ DMG_DIR=/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos
++ basename 'Atomic Server_0.28.2_aarch64.dmg'
+ DMG_NAME='Atomic Server_0.28.2_aarch64.dmg'
+ DMG_TEMP_NAME='/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
++ cd 'Atomic Server.app'
++ pwd
+ SRC_FOLDER='/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/Atomic Server.app'
+ [[ .dmg != \.\d\m\g ]]
+ [[ -z Atomic Server ]]
+ BREW_INSTALL=0
+ AUX_PATH=/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/support
+ '[' 0 -eq 0 ']'
+ test -d /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/support
+ [[ -f /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/Atomic Server.app/.DS_Store ]]
+ echo 'Creating disk image...'
Creating disk image...
+ [[ -f /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg ]]
+ rm -f '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
+ CUSTOM_SIZE=
+ [[ -n '' ]]
+ '[' 0 -eq 0 ']'
+ hdiutil create -srcfolder '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/Atomic Server.app' -volname 'Atomic Server' -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
...............................................................................................
created: /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg
++ get_size '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
+++ du -s '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
+++ sed -e 's/ .*//g'
++ bytes_size=48224
+++ blocks_to_megabytes 48224
+++ MB_SIZE=25
+++ echo 25
++ echo 25
+ DISK_IMAGE_SIZE=25
+ [[ 0 -eq 1 ]]
+ [[ -n '' ]]
++ expr 25 + 20
+ DISK_IMAGE_SIZE=45
++ hdiutil resize -limits '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
++ awk 'NR=1{print int($1/2048+1)}'
+ MIN_DISK_IMAGE_SIZE=24
+ '[' 24 -gt 45 ']'
+ hdiutil resize -size 45m '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
+ echo 'Mounting disk image...'
Mounting disk image...
+ MOUNT_DIR='/Volumes/Atomic Server'
+ [[ -d /Volumes/Atomic Server ]]
+ echo 'Mounting disk image...'
Mounting disk image...
+ echo 'Mount directory: /Volumes/Atomic Server'
Mount directory: /Volumes/Atomic Server
++ hdiutil attach -readwrite -noverify -noautoopen '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/macos/rw.Atomic Server_0.28.2_aarch64.dmg'
++ egrep --color=never '^/dev/'
++ sed 1q
++ awk '{print $1}'
+ DEV_NAME=/dev/disk4
+ echo 'Device name: /dev/disk4'
Device name: /dev/disk4
+ [[ -n '' ]]
+ [[ -n 480 ]]
+ echo 'making link to Applications dir'
making link to Applications dir
+ test -d '/Volumes/Atomic Server/Applications'
+ ln -s /Applications '/Volumes/Atomic Server/Applications'
+ [[ -n '' ]]
+ [[ -n /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/icon.icns ]]
+ echo 'Copying volume icon file '\''/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/icon.icns'\''...'
Copying volume icon file '/Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/icon.icns'...
+ cp /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/icon.icns '/Volumes/Atomic Server/.VolumeIcon.icns'
+ SetFile -c icnC '/Volumes/Atomic Server/.VolumeIcon.icns'
+ [[ -n '' ]]
++ mktemp -t createdmg.tmp.XXXXXXXXXX
+ APPLESCRIPT_FILE=/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/createdmg.tmp.XXXXXXXXXX.ZJcDOTOg
+ [[ 0 -eq 1 ]]
+ [[ 0 -eq 0 ]]
+ applescript_source
+ '[' 0 -eq 0 ']'
+ cat /Users/joep/dev/github/joepio/atomic-data-rust/target/release/bundle/dmg/support/template.applescript
+ sed -e s/WINX/10/g -e s/WINY/60/g -e s/WINW/660/g -e s/WINH/400/g -e s/BACKGROUND_CLAUSE//g -e s/REPOSITION_HIDDEN_FILES_CLAUSE//g -e s/ICON_SIZE/128/g -e s/TEXT_SIZE/16/g
+ perl -pe 's/POSITION_CLAUSE/set position of item "Atomic Server" to {180, 170}
/g'
+ perl -pe s/QL_CLAUSE//g
+ perl -pe 's/APPLICATION_CLAUSE/set position of item "Applications" to {480, 170}
/g'
+ perl -pe 's/HIDING_CLAUSE/set the extension hidden of item "Atomic Server.app" to true
/'
+ sleep 2
+ echo 'Running AppleScript to make Finder stuff pretty: /usr/bin/osascript "/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/createdmg.tmp.XXXXXXXXXX.ZJcDOTOg" "Atomic Server"'
Running AppleScript to make Finder stuff pretty: /usr/bin/osascript "/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/createdmg.tmp.XXXXXXXXXX.ZJcDOTOg" "Atomic Server"
+ /usr/bin/osascript /var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/createdmg.tmp.XXXXXXXXXX.ZJcDOTOg 'Atomic Server'
/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/createdmg.tmp.XXXXXXXXXX.ZJcDOTOg:394:406: execution error: Not authorised to send Apple events to Finder. (-1743)
+ echo 'Failed running AppleScript'
Failed running AppleScript
+ hdiutil detach /dev/disk4
"disk4" ejected.
+ exit 64
Error: failed to bundle project
Caused by:
Shell Scripting Error:`error running bundle_dmg.sh`
app:spawn Command "/Users/joep/.config/yarn/global/node_modules/@tauri-apps/cli/bin/tauri-cli" failed with exit code: 1 +1ms
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 4
- Comments: 38 (7 by maintainers)
Commits related to this issue
- Update package.json fix github action build error https://github.com/tauri-apps/tauri/issues/3055 — committed to yetpocket/cls-verge by taikulawo 4 months ago
There are various threads talking about similar stuff to this. In one of them it recommended to open Photos.app and press ‘Get Started’ (I haven’t used it before on this mac). That actually worked for some reason. 🤷
The issue for me was that the previously built image was open and bundle_dmg.sh couldn’t overwrite it because the old app was running (permission error). Silly problem!
Thanks for the quick reply. it’s happening locally on my m1 macbook
Running into this as well, can confirm that
CI=true npm run tauri buildworksThis should also be fixed when #1731 is done
This worked for me on macOS Sonoma:
Give Terminal.app the permissions to control Finder.app: Go to
System-Settings->Privacy & Security->AutomationThere selectTerminaland below enable the switchFinder.I fixed it! I think the latest version of macOS is responsible here.
error when building with yarn in verbose mode
yarn run tauri build -v:Fixed by enabling “Full Disk Access” in System Settings for Terminal! (and VSCode for its internal terminal)
see your Mac Finder sidebar, you will see something mounted, just delete it, everyting will be ok
These steps solved my issue:
src-tauri/targetfolder.I had to enable full disk access. Might be a better & safer way.
Tried all the above options on macOS and still receiving the same error! Is this still an issue for anyone else?
Commenting because opening Photos.app worked for me on an M1 MacBook Pro…
Before opening Photos.app…
After…