Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the app icon using electron-forge package on Mac?

Can somebody please tell me the instructions for using a custom icon, when compiling an electron app (on mac) when using electron-forge package? Using --icon gives me an error:

error: unknown option `--icon'

What am I missing?

like image 692
Will Stone Avatar asked May 22 '17 21:05

Will Stone


2 Answers

Figured it out. Configure the path to your icon in your package.json.

Electron-Forge v5:

{
  ...
  "config": {
    "forge": {
      ...
      "electronPackagerConfig": {
        "icon": "path/to/icon.icns"
      },
      ...
    }
  }
}

Electron-Forge v6:

{
  ...
  "config": {
    "forge": {
      ...
      "packagerConfig": {
        "icon": "path/to/icon.icns"
      },
      ...
    }
  }
}
like image 95
Will Stone Avatar answered Oct 11 '22 10:10

Will Stone


Per the Options.icon documentation:

If the file extension is omitted, it is auto-completed to the correct extension based on the platform, including when platform: 'all' is in effect

Given that, set the value without extension:

"icon": "./assets/icon"

This is confirmed to work on both Windows and Mac.

like image 35
Cris Avatar answered Oct 11 '22 12:10

Cris