# electron-installer-dmg

> Create DMG installers for your electron apps.

Latest version **5.0.1** (published 2024-07-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install electron-installer-dmg
pnpm add electron-installer-dmg
yarn add electron-installer-dmg
bun add electron-installer-dmg
```

Provides the command `electron-installer-dmg`.

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2024-07-02 |
| First published | 2015-07-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 16 |
| Dependencies | 3 |
| Unpacked size | 303.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 327 |
| Author | Lucas Hrabovsky |
| Maintainers | dbx-node, nbbeeken, orechova, himanshusinghs, c-buckingham, mongo-j, mabaasit, alexander_schroll, mongodb-js-user, rueckstiess, durran, lerouxb, fredtruman, mbroadst, hswolff, satyasinha, matt_d_rat, rhysm, tomhollander, alena.khineika, jeff-allen-mongo, mmarcon, jonathan.balsano, mongodb-build, jack.weir, mcasimir, kristina.stefano, jarjee, shaketbaby, devtoolsbot, addaleax, gribnoysup, mutukrish, vertedinde, georgexu99, erickzhao, marshallofsound, malept, imlucas |
| Keywords | mongodb.js, electron, installer, electron-installer, gulpfriendly, dmg, electron create dmg |

## Links

- npm: https://www.npmjs.com/package/electron-installer-dmg
- Repository: https://github.com/electron-userland/electron-installer-dmg
- Homepage: http://github.com/electron-userland/electron-installer-dmg
- Issues: https://github.com/electron-userland/electron-installer-dmg/issues
- npm.io page: https://npm.io/package/electron-installer-dmg

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.2
- [minimist](https://npm.io/package/minimist.md) ^1.2.7
- [@types/appdmg](https://npm.io/package/@types/appdmg.md) ^0.5.5

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 5.0.1 (latest) — 2024-07-02
- 5.0.0 — 2024-07-02
- 4.0.0 — 2022-04-29
- 3.0.0 — 2019-06-06
- 2.0.0 — 2018-07-12
- 1.0.0 — 2018-05-04
- 0.2.1 — 2017-03-19
- 0.2.0 — 2016-12-29
- 0.1.2 — 2016-08-29
- 0.1.1 — 2016-04-15
- 0.1.0 — 2015-07-06
- 0.0.2 — 2015-07-06
- 0.0.1 — 2015-07-06

## README

# electron-installer-dmg

[![CI status][actions_img]][actions_url]
[![npm][npm_img]][npm_url]
[![Code coverage](https://codecov.io/gh/electron-userland/electron-installer-dmg/branch/main/graph/badge.svg?token=xtM3VTig9I)](https://codecov.io/gh/electron-userland/electron-installer-dmg)

> Create DMG installers for your electron apps using [appdmg][appdmg].

## Requirements

This module requires using macOS and Node 16 or above.

## Installation

**For use in npm scripts:**
```bash
npm i electron-installer-dmg --save-dev
```

**For use from cli:**
```bash
npm i electron-installer-dmg -g
```

## Usage

```
Usage: electron-installer-dmg <path/to/.app> <appname>

Create DMG installers for your electron apps.

Usage:
  electron-installer-dmg ./FooBar-darwin-x64/FooBar.app FooBar

Options:
  --out=<path>         The directory to put the DMG into. [Default: `process.cwd()`].
  --icon=<path>        Path to the icon file that will be the app icon in the DMG window.
  --icon-size=<px>     How big to make the icon for the app in the DMG. [Default: `80`].
  --background=<path>  Path to a PNG image to use as the background of the DMG. [Size: 658 x 498]
  --title=<string>     The title of the produced DMG, which will be shown when mounted.
  --overwrite          Overwrite any existing DMG.
  -h --help            Show this screen.
  --version            Show version.
```

### API

```javascript
const { createDMG } = require('electron-installer-dmg');

async function buildDMG() {
  await createDMG({
    appPath: '/path/to/app.app',
    name: 'MyApp'
  });
}
```
#### createDMG(opts)

##### `opts`

`appPath` - *String* - **Required**
The `.app` directory generated by [electron-packager][electron-packager].

`name` - *String* - **Required**
The application name.

`title` - *String*
The title of the produced DMG, which will be shown when mounted.

`background` - *String*
Path to the background for the DMG window. Background image should be of size 658 × 498.

`icon` - *String*
Path to the icon to use for the app in the DMG window.

`iconSize` - *Number*
How big to make the icon for the app in the DMG. [Default: `80`].

`overwrite` - *Boolean*
Overwrite an existing DMG file if if already exists.

`out` - *String*
The directory to put the DMG into. [Default: `process.cwd()`].

`contents` - *Array* or *Function* that returns an Array of objects.
The content that will appear in the window when user opens the `.dmg` file.
[Default: Array of two icons, application and application destination folder].
Array example:
```javascript
[ { x: 448, y: 344, type: 'link', path: '/Applications'},
  { x: 192, y: 344, type: 'file', path: '/path/to/application.app'} ]
```
Function example (more flexible for getting useful options used in creating a DMG):
```javascript
function (opts) {
   return [ { x: 448, y: 344, type: 'link', path: '/Applications'},
            { x: 192, y: 344, type: 'file', path: opts.appPath} ];
}
```

`format` - *String*
Disk image format. [Default: `UDZO`].

[Must be one of the following][spec]:

- `UDRW` :arrow_right: read/write image
- `UDRO` :arrow_right: read-only image
- `UDCO` :arrow_right: ADC-compressed image
- `UDZO` :arrow_right: zlib-compressed image
- `UDBZ` :arrow_right: bzip2-compressed image
- `ULFO` :arrow_right: lzfse-compressed image (macOS 10.11+ only)

`additionalDMGOptions` - *Object*
Additional options to pass through to [`appdmg`](https://npm.im/appdmg)

You can use this to set additional features like `background-color` and
`code-sign`.  See the docs of the `appdmg` module for all possible options.

## License

Apache 2.0

[actions_img]: https://github.com/electron-userland/electron-installer-dmg/actions/workflows/ci.yml/badge.svg
[actions_url]: https://github.com/electron-userland/electron-installer-dmg/actions/workflows/ci.yml
[npm_img]: https://img.shields.io/npm/v/electron-installer-dmg.svg
[npm_url]: https://npm.im/electron-installer-dmg
[electron-packager]: https://github.com/electron/electron-packager
[appdmg]: https://github.com/LinusU/node-appdmg
[spec]: https://github.com/LinusU/node-appdmg#specification

---
_Source: https://npm.io/package/electron-installer-dmg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
