question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hdiutil error when building for mac

See original GitHub issue

hdiutil outputs an error when building my Electron project. The app is generated and seem to work (tested on two Mac’s with different macOS versions). If I run the hdiutil command manually it doesn’t output anything.

build platform: macOS Sierra 10.12.1 target platform: macOS node: v7.0.0 (also tested on v6.9.1) electron: v1.4.4 electron-builder: 7.14.2

$ DEBUG=electron-builder node_modules/.bin/build -m
Skip app dependencies rebuild because dev and app dependencies are not separated
Packaging for platform darwin x64 using electron 1.4.4 to dist/mac

  electron-builder Spawning /Users/stefan/Documents/Development/Electron/electron-project/node_modules/7zip-bin-mac/7za x -bd /Users/stefan/.electron/electron-v1.4.4-darwin-x64.zip -o/Users/stefan/Documents/Development/Electron/electron-project/dist/mac +0ms

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 42004724 bytes (41 MiB)

Extracting archive: /Users/stefan/.electron/electron-v1.4.4-darwin-x64.zip
--
Path = /Users/stefan/.electron/electron-v1.4.4-darwin-x64.zip
Type = zip
Physical Size = 42004724

Everything is Ok

Folders: 143
Files: 180
Size:       111898036
Compressed: 42004724
  electron-builder /Users/stefan/Documents/Development/Electron/electron-project/node_modules/7zip-bin-mac/7za (2024) exited with code 0 +2s
  electron-builder Executing security find-identity -v +15s
  electron-builder Executing security find-identity -v -p codesigning +15ms
  1) 3674B13AC4B3F29509C7D08D9FBE27C735583EEB "Company name #1 AB"
  2) F96DBB184A79B1BB61B5D652C029E59616D2771D "Company name #2 AB"
     2 valid identities found

  1) 7622AC77D96864FE8F6306129A143C16C33194DC "com.apple.idms.appleid.prd.4969564e66456a5a4a785a765074415978646b526d513d3d"
  2) 3674B13AC4B3F29509C7D08D9FBE27C735583EEB "Company name #1 AB"
  3) F96DBB184A79B1BB61B5D652C029E59616D2771D "Company name #2 AB"
     3 valid identities found

Signing app (identity: Company name #1 AB)

Creating DMG
Creating MacOS zip
  electron-builder Spawning /Users/stefan/Documents/Development/Electron/electron-project/node_modules/7zip-bin-mac/7za a -bd -mm=Deflate /Users/stefan/Documents/Development/Electron/electron-project/dist/mac/Synchronize-0.1.0-mac.zip Synchronize.app +23s
  electron-builder Executing hdiutil create -srcfolder /var/folders/4x/dqxg9wkj1w38n7wz143kjqhm0000gn/T/electron-builder-jpnSeC/t-7e7-0-dmg/.background -srcfolder /Users/stefan/Documents/Development/Electron/electron-project/dist/mac/Synchronize.app -volname Synchronize 0.1.0 -anyowners -nospotlight -quiet -fs HFS+ -fsargs -c c=64,a=16,e=16 -format UDRW /var/folders/4x/dqxg9wkj1w38n7wz143kjqhm0000gn/T/electron-builder-jpnSeC/t-7e7-0-dmg/temp.dmg +15ms

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive:
151 folders, 185 files, 143023290 bytes (137 MiB)

Creating archive: /Users/stefan/Documents/Development/Electron/electron-project/dist/mac/Synchronize-0.1.0-mac.zip

Items to compress: 336

Error: Exit code: 1. Command failed: hdiutil create -srcfolder /var/folders/4x/dqxg9wkj1w38n7wz143kjqhm0000gn/T/electron-builder-jpnSeC/t-7e7-0-dmg/.background -srcfolder /Users/stefan/Documents/Development/Electron/electron-project/dist/mac/Synchronize.app -volname Synchronize 0.1.0 -anyowners -nospotlight -quiet -fs HFS+ -fsargs -c c=64,a=16,e=16 -format UDRW /var/folders/4x/dqxg9wkj1w38n7wz143kjqhm0000gn/T/electron-builder-jpnSeC/t-7e7-0-dmg/temp.dmg

    at /Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/util/util.ts:102:16
    at ChildProcess.exithandler (child_process.js:218:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
From previous event:
    at Object.exec (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/util/util.ts:80:3)
    at DmgTarget.<anonymous> (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/targets/dmg.ts:49:15)
    at Generator.next (<anonymous>)
    at /Users/stefan/Documents/Development/Electron/electron-project/node_modules/fs-extra-tf/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/stefan/Documents/Development/Electron/electron-project/node_modules/graceful-fs/graceful-fs.js:43:10
    at /Users/stefan/Documents/Development/Electron/electron-project/node_modules/fs-extra-tf/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:111:15)
From previous event:
    at tsAwaiter (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/util/awaiter.ts:10:47)
    at DmgTarget.build (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/out/targets/dmg.js:20:16)
    at MacPackager.packageInDistributableFormat (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/macPackager.ts:195:25)
    at nonMasPromise.doPack.then.then (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/macPackager.ts:80:16)
From previous event:
    at MacPackager.<anonymous> (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/macPackager.ts:79:10)
    at Generator.next (<anonymous>)
From previous event:
    at tsAwaiter (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/src/util/awaiter.ts:10:47)
    at Object.build (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/out/builder.js:138:12)
    at Object.<anonymous> (/Users/stefan/Documents/Development/Electron/electron-project/node_modules/electron-builder/out/build-cli.js:23:11)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.runMain (module.js:607:10)
    at run (bootstrap_node.js:382:7)
    at startup (bootstrap_node.js:137:9)
    at bootstrap_node.js:497:3

Files read from disk: 185
Archive size: 47025365 bytes (45 MiB)
Everything is Ok
{
  "name": "Synchronize",
  "description": "<description>",
  "version": "0.1.0",
  "author": "<author>",
  "main": "electron.js",
  "build": {
    "appId": "com.visitortoolbox.synchronize",
    "mac": {
      "category": "public.app-category.productivity"
    },
    "win": {
      "iconUrl": "https://vtfiles.blob.core.windows.net/app/com.visitortooblox.synchronize.ico"
    }
  }
  },
  "scripts": {
    ...
    "pack": "build --dir",
    "dist": "build --mac"
  },
  "dependencies": {
    ...
  },
  "devDependencies": {
   ...
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
stefanedbergcommented, Nov 1, 2016

Damn. I’ve been running the build on my work computer which has AVG AntiVirus installed… The realtime protection caused the problem, now the build runs fine. Thanks again @develar.

1reaction
karimhossenbuxcommented, Aug 12, 2018

Got the error with Sophos too, works properly by deactivate it

Read more comments on GitHub >

github_iconTop Results From Across the Web

hdiutil error -5341 creating .dmg | Apple Developer Forums
I am trying to construct a .dmg containing my application bundle, an examples directory, and a readme file. I use a shell script...
Read more >
Error hdiutil: create failed - File exists -> but the file does not ...
This is a workaround for the issue, but not a resolution. This allows me to use the image on the NFS share, but...
Read more >
macos - hdiutil: create failed - error -5342 - Stack Overflow
1 Answer 1 ... I often had this problem, until I learned (somewhere) that hdiutil often mis-calculates the size, and that causes it...
Read more >
'No Mountable File System' Mac Error: Can't Open Disk Images
The error "No mountable file systems" showing up on your Mac indicates that the disk image (or dmg file) cannot be mounted and...
Read more >
macOS Error Opening .dmg Disk Image - No Mountable File ...
Type hdiutil attach -verbose into the terminal. Add a space at the end, but don't press enter yet. Drag the dmg file from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found