Giter Site home page Giter Site logo

create-dmg's Introduction

create-dmg

Create a good-looking DMG for your macOS app in seconds

Imagine you have finished a macOS app, exported it from Xcode, and now want to distribute it to users. The most common way of distributing an app outside the Mac App Store is by putting it in a .dmg file. These are hard to create, especially good-looking ones. You can either pay for a GUI app where you have to customize an existing design or you can run some homebrewed Bash script and you still have to design it. This tool does everything for you, so you can play with your 🐈 instead.

This tool is intentionally opinionated and simple. I'm not interested in adding lots of options.

Install

Ensure you have Node.js 18 or later installed. Then run the following:

npm install --global create-dmg

Usage

$ create-dmg --help

  Usage
    $ create-dmg <app> [destination]

  Options
    --overwrite          Overwrite existing DMG with the same name
    --identity=<value>   Manually set code signing identity (automatic by default)
    --dmg-title=<value>  Manually set DMG title (must be <=27 characters) [default: App name]

  Examples
    $ create-dmg 'Lungo.app'
    $ create-dmg 'Lungo.app' Build/Releases

DMG

The DMG requires macOS 10.13 or later and has the filename App Name 0.0.0.dmg. For example, Lungo 1.0.0.dmg.

It will try to code sign the DMG, but the DMG is still created and fine even if the code signing fails, for example if you don't have a developer certificate.

Important: Don't forget to notarize your DMG.

Software license agreement

If either license.txt, license.rtf, or sla.r (raw SLAResources file) are present in the same directory as the app, it will be added as a software agreement when opening the image. The image will not be mounted unless the user indicates agreement with the license.

/usr/bin/rez (from Command Line Tools for Xcode) must be installed.

DMG icon

GraphicsMagick is required to create the custom DMG icon that's based on the app icon and the macOS mounted device icon.

Steps using Homebrew

brew install graphicsmagick imagemagick

Icon example

Original icon → DMG icon

Related

create-dmg's People

Contributors

cykelero avatar dminta avatar dxdc avatar fcastilloec avatar ivoronin avatar kwvg avatar lohoris avatar manrueda avatar marwanhawari avatar mathiaswp avatar neonowy avatar richienb avatar sindresorhus avatar stephenplusplus avatar willowblade avatar zorgiepoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-dmg's Issues

Codesign identity as optional parameter

For two Developer ID distribution certificates installed on my machine (both from different teams) I receive following warning:

Code signing failed. The DMG is fine, just not code signed.
Developer ID Application: ambiguous (matches "Developer ID Application: OrganizationA (XXXXXXXXXX)" and "Developer ID Application: OrganizationB (YYYYYYYYY)" in /Users/user/Library/Keychains/login.keychain-db)
XXXXXXXXXX

It would be nice to have an optional parameter to resolve this issue, for example:

--identity "Developer ID Application: OrganizationB (YYYYYYYYY)"

Solved - need help for 'Error: spawn Unknown system error -86'

create-dmg gui.app           
ℹ Minimum runtime 10.11 detected, using ULFO format
✖ Code signing failed. The DMG is fine, just not code signed.
Error: spawn Unknown system error -86

create-dmg version: 5.5.1
Platfrom: M1 Max Macbook Pro
OSX: MacOS Venture
Node version: 19.4.0
npm version: 9.2.0

It was able to sign successfully and no such error, before I recover the machine.
Same machine Same OS but new error, don't know where goes wrong, Really need author help, Thx a lot!

allow passing the DMG format

Allow passing the compression type (or DMG format) since lzfse compression requires a relatively modern MacOS version. Are you willing to accept a PR?

Installation Fail

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the fs-xattr package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs fs-xattr
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls fs-xattr

License addition doesn't work on macOS Big Sur

Version: 5.3.0

When I'm trying to add license.txt it fails with the following message:

✖ Code signing failed. The DMG is fine, just not code signed.
hdiutil: unflatten: verb not recognized
Usage: /usr/bin/hdiutil <verb> <options>
<verb> is one of the following:
help
attach
detach
eject
verify
create
compact
convert
burn
info
checksum
chpass
erasekeys
imageinfo
isencrypted
makehybrid
mount
mountvol
unmount
plugins
resize
segment
pmap
udifderez
udifrez

It seems to be a known issue and here's how it's fixed in electron-builder.

Code signing identity: (unavailable)

As far as I know I have the appropriate certificate installed but create-dmg always returns Code signing identity: (unavailable).

However, if I don't use the --identity parameter, it simply reports:

Code signing failed. The DMG is fine, just not code signed.
No suitable code signing identity found

Is this an issue with create-dmg or am I dining something wrong?

In case it helps, these are the results of running certtool and security to query for a valid code signing certificate:

$ certtool y | grep "Apple Development"
Common Name     : Apple Development: XXXXXXX (YYYYYYY)

$ security find-identity -p codesigning

Policy: Code Signing
  Matching identities
  1) 631CE7F7260DDB20BCD2BC1727AC015A21945DAE "Apple Development: XXXXXXX (YYYYYYY)"
  2) 631CE7F7260DDB20BCD2BC1727AC015A21945DAE "Apple Development: XXXXXXX (YYYYYYY)"
     2 identities found

  Valid identities only
  1) 631CE7F7260DDB20BCD2BC1727AC015A21945DAE "Apple Development: XXXXXXX (YYYYYYY)"
  2) 631CE7F7260DDB20BCD2BC1727AC015A21945DAE "Apple Development: XXXXXXX (YYYYYYY)"
     2 valid identities found

Installing graphicsmagick and imagemagick for the dmg icon generation in Github Actions is unbearably slow

I integrated your create-dmg tool into my github actions workflow:
https://github.com/bjesuiter/macos-file-summoner/blob/master/.github/workflows/go.yml

However, when installing imagemagic and graphicsmagick, the automated build takes ages longer than without them, because they are so big.

I tried to combat this by using gihub cache actions and caching the homebrew cache dir, but since this thing has 2,4 gb this is also painfully slow.

Could you implement another solution which is more lightweight to update this dmg icon?

add support for newer node

once I upgrade node to v10.11, it seems that current version would not work

internal/modules/cjs/loader.js:718
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/usr/local/lib/node_modules/create-dmg/node_modules/macos-alias/build/Release/volume.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 59. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/create-dmg/node_modules/macos-alias/lib/create.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)

Downgrade to v9.11.1 can walk around but it is not eligant

DMG GUI looks weird

My dmg-UI has some pictures with labels ".background" and ".VolumeIcon.icns" projected below the other ones. I just ran 'create-dmg "fixture.app"' to create fixture-0.0.1.dmg in the project itself. This also happens to my own app. Any idea why?
screen shot 2017-05-09 at 20 55 34
Thanks,
Hans

Code signing failed

Hey, I have an electron app which I package using electron-packager.

I'm trying to use create-dmg on it and it fails.

$ create-dmg Proton.app
✖ Code signing failed. The DMG is fine, just not code signed.
error: The specified item could not be found in the keychain.

What should be in my keychain? Thanks

Upcoming OS X signing changes

Hey guys,

First, thank you @sindresorhus for making this wonderful tool. I love using it.

Everything was working fine and dandy for my Mac OS X application.
Code signing started to fail and I started to look into it.

As you can see in:
img

It looks like we need to sign the dmg using the Developer ID Installer profile and not a Developer ID Application profile. I say it looks like because I am still debugging.

img

context:

  • using fastlane tools to generate .app via gem 'fastlane-plugin-dmg' which does:
lane :build_mac_dmg do
    version_num = get_info_plist_value(path: "./App/Info.plist", key: "CFBundleShortVersionString")
    # this is -1 b/c after successful build we incremented this number (in Xcode)
    build_num = get_info_plist_value(path: "./App/Info.plist", key: "CFBundleVersion").to_i - 1

    _release_location = "releases/#{version_num}/#{build_num}"
    destination_dir = File.join(File.dirname(File.expand_path('.')), _release_location)
    _dmg_location = File.join(destination_dir, "App.dmg")

    remove_zip = File.join(destination_dir, "*.zip")
    remove_app = File.join(destination_dir, "*.app")

    sh "rm #{remove_zip}"

    dmg(
      path: _release_location, 
      output_path: _dmg_location,
      volume_name: "App"
    )

    sh "rm -rf #{remove_app}"
  end
  • then we just cd into _release_location and run create-dmg App.app
  • the dmg is created fine but is not signed anymore

Tried to do it manually to figure it out the cli.js:

####### Command 1
$ codesign --force --sign "Developer ID Application: Alex Kluew (6E9FSS8PG2)" App.dmg
####### Result
App.dmg: A timestamp was expected but was not found.
####### Command 2
$ spctl -a -t open --context context:primary-signature -v App.dmg
####### Result
App.dmg: rejected
source=no usable signature

At the moment not sure where to proceed.

Conclusion

Mainly posting here to see if anyone else is struggling or it is just me?
Kind of looks like they changed something in the Mac signing process but I am not intimate with this process.

They also added the notarization process... so this may be an issue in the future as well...

Thanks for any help.

Cheers,
Alex

Related

BUG: appName seems to be undefined

My Steps:

  • create-dmg DisableSynergy.app

Error:

/usr/local/lib/node_modules/create-dmg/cli.js:46
const dmgPath = `${appName.replace(/ /g, '-')}-${appInfo.CFBundleShortVersionString}.dmg`;
                                                   ^

TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/create-dmg/cli.js:46:28)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3

I tried lots of combinations, paths as app name, masking directory changes with pushd and popd, but even this simplest version does not work. Where does this appName come from?
I've written my PList file myself, so it could be that I miss a plist key.

This is my plist file:

<?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">
  <array>
    <dict>
      <key>CFBundleIdentifier</key>
      <string>de.bjesuiter.disable-synergy</string>
      <key>CFBundleVersion</key>
      <string>1.0.0</string>
      <key>CFBundleShortVersionString</key>
      <string>1.0.0</string>
      <key>CFBundleName</key>
      <string>Disable Synergy</string>
      <key>CFBundleDisplayName</key>
      <string>Disable Synergy</string>
      <key>CFBundlePackageType</key>
      <string>APPL</string>
      <key>CFBundleIconFile</key>
      <string>AppIcon</string>
      <key>CFBundleIconName</key>
      <string>AppIcon</string>
    </dict>
  </array>
</plist>

DMG Icon is blurry

My custom DMG icon is blurry for some versions. I’ve added all the right resolution icons in my Assets.xcassets AppIcon. If I mount the DMG, the icon looks perfect.

image
image

Build Errors

xxx$ npm install --global create-dmg
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/usr/local/bin/create-dmg -> /usr/local/lib/node_modules/create-dmg/cli.js

[email protected] install /usr/local/lib/node_modules/create-dmg/node_modules/fs-xattr
node-gyp rebuild

CXX(target) Release/obj.target/xattr/src/async.o
../src/async.cc:35:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(1, argv);
^
../../nan/nan.h:1739:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Localv8::Value
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'

define NAN_DEPRECATED attribute((deprecated))

                                   ^

../src/async.cc:52:46: error: no matching member function for call to 'ToObject'
v8::Localv8::Object bufferObj = value->ToObject();
~~~~~~~^~~~~~~~
/Users/sbuck/.node-gyp/12.3.1/include/node/v8.h:2532:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
V8_WARN_UNUSED_RESULT MaybeLocal ToObject(
^
/Users/sbuck/.node-gyp/12.3.1/include/node/v8.h:2546:35: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
Local ToObject(Isolate* isolate) const);
^
../src/async.cc:129:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(2, argv);
^
../../nan/nan.h:1739:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Localv8::Value
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'

define NAN_DEPRECATED attribute((deprecated))

                                   ^

../src/async.cc:186:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(2, argv);
^
../../nan/nan.h:1739:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Localv8::Value
^
../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'

define NAN_DEPRECATED attribute((deprecated))

                                   ^

3 warnings and 1 error generated.
make: *** [Release/obj.target/xattr/src/async.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/create-dmg/node_modules/fs-xattr
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2019-05-23T20_20_33_502Z-debug.log

Custom DMG icon is gone after uploading and downloading

When I create my Disk Image it has the custom icon, but then if I upload it to S3 or GitHub and download it, the icon is missing. It might be something I’m doing, but have you ever seen this happen?

Left is original, right is after downloading from GitHub.
image

Install failed with error code 1

not sure if this is an npm problem or create-dmg problem

% npm install --global create-dmg
npm ERR! code 1
npm ERR! path /Users/Dainternetdude/.npm-global/lib/node_modules/create-dmg/node_modules/macos-alias
npm ERR! command failed
npm ERR! command sh /var/folders/v1/5mxh2fmd06z3tll92x44slgr0000gq/T/install-40e9f126.sh
npm ERR! CXX(target) Release/obj.target/volume/src/volume.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.7.13 found at "/Users/Dainternetdude/miniconda3/bin/python3"
npm ERR! gyp info spawn /Users/Dainternetdude/miniconda3/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/Dainternetdude/.npm-global/lib/node_modules/create-dmg/node_modules/macos-alias/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/Dainternetdude/Library/Caches/node-gyp/16.17.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/Dainternetdude/.npm-global/lib/node_modules/create-dmg/node_modules/macos-alias',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/volume.cc:2:
npm ERR! In file included from ../../nan/nan.h:60:
npm ERR! In file included from /Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/include/node/node.h:73:
npm ERR! In file included from /Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/include/node/v8.h:22:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:590:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:457:11: error: use of undeclared identifier 'nanosleep'
npm ERR!    while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
npm ERR!           ^
npm ERR! In file included from ../src/volume.cc:2:
npm ERR! In file included from ../../nan/nan.h:60:
npm ERR! In file included from /Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/include/node/node.h:73:
npm ERR! In file included from /Users/Dainternetdude/Library/Caches/node-gyp/16.17.0/include/node/v8.h:24:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:532:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:192:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__string:30:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cwchar:117:9: error: target of using declaration conflicts with declaration already in scope
npm ERR! using ::tm _LIBCPP_USING_IF_EXISTS;
npm ERR!         ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/wchar.h:131:19: note: target of using declaration
npm ERR!             const struct tm * __restrict) __DARWIN_ALIAS(wcsftime);
npm ERR!                          ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ctime:80:1: note: conflicting declaration
npm ERR! using ::tm _LIBCPP_USING_IF_EXISTS;
npm ERR! ^
npm ERR! 2 errors generated.
npm ERR! make: *** [Release/obj.target/volume/src/volume.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/Dainternetdude/.npm-global/lib/node_modules/create-dmg/node_modules/macos-alias
npm ERR! gyp ERR! node -v v16.17.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Dainternetdude/.npm/_logs/2022-08-29T03_40_37_211Z-debug-0.log

2022-08-29T03_40_37_211Z-debug-0.log

Fails without error message when app doesn't have an icon

I tried to create DMG for an app under development to share it with friends and this tool simply returned red "x".

To find out the issue, I replaced process.exit(1) with throw error and got following error output:

TypeError: Cannot read property 'replace' of undefined
    at init (/Users/xxx/.config/yarn/global/node_modules/create-dmg/cli.js:82:47)
    at Object.<anonymous> (/Users/xxx/.config/yarn/global/node_modules/create-dmg/cli.js:190:1)
    at Module._compile (internal/modules/cjs/loader.js:1157:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

Looks like this is because the app doesn't have an icon yet. The tool should print a more useful error message in that case.

[Feature request] Output dir

Hey,

This is a great tool but it would be awesome if you could let us choose the output directory rather than creating the .dmg on the current directory.

Thanks!

Option to not sign (or throw different error code)

When using this CLI module inside a script, there's no way to differentiate between an error when creating a DMG or simply this warning message Code signing failed. The DMG is fine, just not code signed.
I would like to have an option to not sign the DMG. I understand that this module is trying to be as simply as possible, so as an alternative, would it be possible to not throw any error for that warning? or just throw a different error code? For example, process.exit(2) for the case described above, so it's easy to know what the error is about and handle it.

It's a good practice for CLI apps to throw different error codes, depending on the errors themsleves, and document what each one represent.

Created DMGs don't work on Mac OS Yosemite

First of all, thanks for making create-dmg! I'm using as part of my build pipeline.

Recently I got a support call from a customer who was getting errors when trying to open the DMG. DiskImageMounter claimed that the disk image was corrupt. They were using a MacBook Pro with Mac OS Yosemite.

I was able to set up a remote connection over TeamViewer and used the shasum command in Terminal to check the integrity of the file. It matches exactly with the file on my mac yet it won't open on their computer. I thought it must be a fluke, but they get the same error on two different laptops, both running Yosemite.

Do you know of anything that could be causing this? Are you using some new, cutting-edge DMG format or something?

Allow overwriting file if exists

It would be nice to have overwriting dmg option if file already exists. For now we just have following error:

✖ Error: Target already exists

Support for APFS and LZMA compression

I'm creating this to discuss support for creating APFS disk images (which requires 10.13+) and disk images using "ULMO" (or lzma compressed) format (which requires 10.15+). Both of these are 'relatively' modern features/enhancements to dmgs.

Given that this tool is "opinionated", if the app minimum system requirement is >= 10.13, I think it always makes sense to just opt into creating APFS disk images over HFS+ ones.

For the ULMO format it's not always really clear cut if the developer wants fast decompression (lzfse) or significantly reduced file compression (lzma). (In some cases for my relatively-small apps I find the decompression speed difference to be less noticeable while the compression file size savings to be more significant for example; lzma is much better than bzip2). In this case, I'd perhaps suggest an "extra-compression" or "heavy-compression" option which uses ULMO if the minimum system requirement is >= 10.15, otherwise use UDBZ (bzip2) (or perhaps don't support UDBZ at all).

Either way, it's not possible to integrate these modern-parity enhancements right now. I've added pull requests to the upstream node-appdmg project for adding them there first (including more motivational details). I created this to open a discussion as I'm not sure whether these are wanted here.

LinusU/node-appdmg#220
LinusU/node-appdmg#221

Osx, dmg

I'm trying to create a DMG file. I've done it before, but now it gives the following error.

chmod +x shfile
./shfile

.....
created: /Users/ahmetaligul/Library/Keyboard Layouts/rw.osmanlıcaKlavye.dmg
Mounting disk image...
Mount directory: /Volumes/Applicationinstaller
Device name: /dev/disk2
Copying background file 'installer_background.png'...
Making link to Applications dir...
/Volumes/Applicationinstaller
Running AppleScript to make Finder stuff pretty: /usr/bin/osascript "/var/folders/pw/w8jsyzgs3b583zknqrc08rc80000gn/T/createdmg.tmp.XXXXXXXXXX.8qEW5kks" "Applicationinstaller"
/var/folders/pw/w8jsyzgs3b583zknqrc08rc80000gn/T/createdmg.tmp.XXXXXXXXXX.8qEW5kks:953:1009: execution error: Finder got an error: Can’t set item "x.app" of disk "Applicationinstaller" to {275, 575}. (-10006)
Failed running AppleScript
"disk2" ejected.

Error installing

Unable to install either locally or globally. Error seems to be related to installation of Xcode tools. But I have both Xcode and Xcode cli tools installed.
Potential cause could be because I am running MacOS High Sierra?

➜  Desktop npm i -g create-dmg
/usr/local/bin/create-dmg -> /usr/local/lib/node_modules/create-dmg/cli.js

> [email protected] install /usr/local/lib/node_modules/create-dmg/node_modules/macos-alias
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/usr/local/Cellar/node/8.1.0_1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/create-dmg/node_modules/macos-alias
gyp ERR! node -v v8.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/meadowcottage/.npm/_logs/2017-06-22T13_20_18_842Z-debug.log

Completely Signed and Notarized App doesn't work anymore when loaded from DMG

I created an app build and signed, notarized and stapled it completely.
See the Step Build, Sign & Notarize App in my github workflow.

This produces the 'dist' artefact, which is simply my complete dist folder uploaded as github actions artifact. You can:

The Problem

When Installing the same app from the DMG created with create-dmg,
the app does appear to be valid by spctl, but it can't be run.

(You can download the dmg from the same github actions run directly here:
https://github.com/bjesuiter/macos-file-summoner/suites/819538575/artifacts/9026759)

❯ spctl -a -vvvv /Applications/File\ Summoner.app             
/Applications/File Summoner.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: Benjamin Jesuiter (BB38WRH6VJ)

When running, it produces the following error message:
(Which reads: 'The app File Summoner.app can't be opened' in german)
Bildschirmfoto 2020-06-20 um 01 41 25

Could you please look into what is going on here?

"was compiled against a different Node.js version"

I'm trying to run create-dmg after a while, and I keep getting this error.

internal/modules/cjs/loader.js:752
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/usr/local/lib/node_modules/create-dmg/node_modules/macos-alias/build/Release/volume.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 67. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:752:18)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:659:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/create-dmg/node_modules/macos-alias/lib/create.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:723:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)

I've tried to hard-rebuild it removing the node_modules directory and reinstalling it, but nothing changed.

I'm a bit clueless about what to do, I've searched a lot and came out with nothing useful at all.

hdiutil: couldn't un mount "disk2" - Resource busy

OS: macOS Catalina 10.15.2
node: 12.14.0
npm: 6.13.4
create-dmg: 4.2.0


Hi. I'm using create-dmg to create dmg from my app file:

create-dmg ../dist/mac/MyApp.app ../dist --overwrite

But always got the following error output

✖ Building the DMG failed. Error: Command failed: hdiutil detach /Volumes/MyApp
hdiutil: couldn't unmount "disk2" - Resource busy

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] installer:macos: `create-dmg ../dist/mac/MyApp.app ../dist --overwrite`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] installer:macos script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
...

When this error happens, Disk Utility always shows a mounted image as shown below:

disk

Created DMG name?

Hello!

What do you think about the new option to write generated .dmg filename to console?
For example:

✔ DMG mydmg.dmg created

instead of

✔ DMG created

It might be very useful and more informative.
If you agree with this, I can try to create PR :)

Unable to create dmg

MacBook-Air-2:~ XXXXX$ create-dmg 'TinkerTool.app'
fs.js:583
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: ENOENT: no such file or directory, open '/Users/xxxxx/TinkerTool.app/Contents/Info.plist'
at Object.fs.openSync (fs.js:583:18)
at Object.fs.readFileSync (fs.js:490:33)
at Object. (/usr/local/lib/node_modules/create-dmg/cli.js:30:32)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:425:7)
MacBook-Air-2:~ XXXXX$

Command return X only

Hello Team,

I have installed this script through the terminal using HomeBrew. Now I tried to create DMG and get the only X in response. Have a look at the attached screenshot here.

Can you help me in identifying what exactly I am doing wrong here?

Screenshot 2020-03-05 at 1 17 49 PM

Thanks,
Malav Soni

Fetching the resulting dmg name

I'm having a difficult time fetching the resulting DMGs name from within an bash script. Is it me, or is the nature of the updated output part of the problem?

Building the DMG failed

macOS 12.3.1

Looks like the bless api changed in macOS 12.3
See: create-dmg/create-dmg#127

% create-dmg MyApp.app 
ℹ Minimum runtime 10.14 detected, using ULFO format
✖ Building the DMG failed. Error: Command failed: bless --folder /Volumes/MyApp --openfolder /Volumes/MyApp
bless: The 'openfolder' is not supported on Apple Silicon devices.

create-dmg fails on OSX Catalina

Hi!

Apparently, create-dmg does not work in the lastest release of OSX.

Using "create-dmg=5.1.0", the executable fails in OSX 10.15.4:

create-dmg --help

Returns the following traceback:

internal/modules/cjs/loader.js:1173
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/Users/myuser/Downloads/myapp/node_modules/macos-alias/build/Release/volume.node, 1): Symbol not found: _kCFURLVolumeNameKey
  Referenced from: /Users/myuser/Downloads/myapp/node_modules/macos-alias/build/Release/volume.node
  Expected in: flat namespace
 in /Users/myuser/Downloads/myapp/node_modules/macos-alias/build/Release/volume.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1173:18)
    at Module.load (internal/modules/cjs/loader.js:972:32)
    at Function.Module._load (internal/modules/cjs/loader.js:872:14)
    at Module.require (internal/modules/cjs/loader.js:1012:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/myuser/Downloads/myapp/node_modules/macos-alias/lib/create.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:1123:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:972:32)
    at Function.Module._load (internal/modules/cjs/loader.js:872:14)

Thank you!

Error: data.title is required

Whenever I attempt to create a dmg with the simplest command create-dmg Launcher.app it throws the error that data.title is required.

When specifying the --dmg-title=Launcher.dmg option, it will work, but creates a dmg file that does not have the specified name, but rather undefined undefined.dmg.

Fails on macOS 12.3+

Fails on the latest macOS Monterey with the error:

ℹ Minimum runtime 10.13 detected, using ULFO format
✖ Building the DMG failed. Error: Command failed: bless --folder /Volumes/AppName --openfolder /Volumes/AppName
bless: The 'openfolder' is not supported on Apple Silicon devices.

I ran the command with no extra options, like create-dmg AppName.app.

Likely related issue: create-dmg/create-dmg#127

Cannot find module '../build/Release/volume.node'

when I execute "create-dmg --help", error happen, can you tell me why.
I am a newer to node.js, thanks~


module.js:471
throw err;
^

Error: Cannot find module '../build/Release/volume.node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/create-dmg/node_modules/macos-alias/lib/create.js:7:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Unable to read binary format plist file

Issuehunt badges

I created a simple MacOS application from command line script by Platypus. I got the following error message when trying to use create-dmg to create a .dmg file.

/usr/local/lib/node_modules/create-dmg/node_modules/plist/lib/parse.js:68
    doc.documentElement.nodeName === 'plist',
                        ^

TypeError: Cannot read property 'nodeName' of null
    at Object.parse (/usr/local/lib/node_modules/create-dmg/node_modules/plist/lib/parse.js:68:25)
    at Object.<anonymous> (/usr/local/lib/node_modules/create-dmg/cli.js:57:23)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
    at executeUserCode (internal/bootstrap/node.js:526:15)
    at startMainThreadExecution (internal/bootstrap/node.js:439:3)

I ended up figuring it out that create-img fails due to the wrong format (binary instead of xml/text) of Info.plist in app's contents directory. So I use plutil -convert xml1 Info.plist to convert the plist file to XML from binary. This solved the problem.

Is it an issue with create-dmg?


IssueHunt Summary

neonowy neonowy has been rewarded.

Backers (Total: $30.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

Build version not matching version in package.json

When I bump the version in package*.json and I run, e.g.

./node_modules/.bin/create-dmg './build/Twitter-darwin-x64/Twitter.app' --overwrite --dmg-title='Twitter' --identity='Aubrey Portwood' ./dist/"

The version in dist/ is always 1.0.0.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.