18

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?

2 Answers 2

49

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"
      },
      ...
    }
  }
}
8
  • 9
    Thanks! Might be obvious to others, but this doesn't change the icon when running in electron-forge start
    – kevando
    Oct 19, 2018 at 3:40
  • 1
    I can't find the documentation for this anywhere- can someone point to some (hopefully always-current) documentation link? (the larger question is: what are the parameters/constraints of this icon? etc...)
    – Phildo
    Apr 10, 2019 at 18:51
  • 2
    @Phildo electronforge.io/configuration#packager-config although it is now documenting Version 6.
    – None
    Dec 10, 2019 at 16:05
  • 5
    Is this solution cross-platform? It seems macOS specific? Since package.json is shared by all platforms. I wonder how this could extend to Windows.
    – kakyo
    May 21, 2020 at 10:56
  • 6
    @TengBangWei windows icons use .ico and macOS uses .icns
    – KetZoomer
    Jan 23, 2021 at 0:15
8

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.