Can't get macOS icon to show up with packaged app due to wrong size
See original GitHub issue- [ x] I have read the contribution documentation for this project.
- [ x] I agree to follow the code of conduct that this project follows, as appropriate.
- [ x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
Please describe your issue:
I’m trying to package my app with electron-forge
for Mac OS, and it works to package it except for the fact that I can’t seem to get the icon to show up for the app. I’ve added icon.icns
and icon.ico
files and referred to them in the forge.config.js
file (which is referenced in package.json
, and according to the debug logs everything seems to be detected but yet the icon isnt showing up (a generic mac app icon shows up instead).
Viewing the Package Contents > Contents > Resources
folder of the App shows my icon but it is named electron.icns
. Viewing the Info.plist
shows this
<key>CFBundleIconFile</key>
<string>electron.icns</string>
which also seems to be correct.
I even tried drag/drop the icon.icns
to the app via the Get Info panel but even that can’t seem to work…
The weird thing is it seem to work many months ago, with the biggest difference I can guess being that I updated to Mojave OS…? I don’t even think the node, npm, electron and electron-forge version changed.
Console output when you run electron-forge
with the environment variable DEBUG=electron-forge:*
. (Instructions on how to do so here). Please include the stack trace if one exists.
WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle
electron-forge:lifecycle Process Started: Checking your system +0ms
electron-forge:lifecycle Process Succeeded: Checking your system +685ms
electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle
electron-forge:lifecycle Process Started: Preparing to Package Application for arch: x64 +0ms
electron-forge:project-resolver searching for project in: /Users/jeff/Projects/teleo-desktop +0ms
electron-forge:project-resolver electron-forge compatible package.json found in /Users/jeff/Projects/teleo-desktop/package.json +12ms
electron-forge:hook could not find hook: generateAssets +0ms
electron-forge:hook could not find hook: prePackage +1ms
electron-forge:packager packaging with options { asar: true,
overwrite: true,
protocol: 'teamrepo://',
icon: '/Users/jeff/Projects/teleo-desktop/src/icon',
afterCopy: [ [Function] ],
afterExtract: [ [Function] ],
afterPrune: [ [Function] ],
dir: '/Users/jeff/Projects/teleo-desktop',
arch: 'x64',
platform: 'darwin',
out: '/Users/jeff/Projects/teleo-desktop/out',
electronVersion: '1.8.4',
quiet: true } +0ms
electron-forge:lifecycle Process Succeeded: Preparing to Package Application for arch: x64 +42s
electron-forge:lifecycle Process Started: Compiling Application +0ms
electron-forge:lifecycle Process Succeeded: Compiling Application +2s
electron-forge:lifecycle Process Started: Preparing native dependencies +17s
electron-forge:lifecycle Process Succeeded: Preparing native dependencies +152ms
electron-forge:lifecycle Process Started: Packaging Application +0ms
electron-forge:hook could not find hook: postPackage +1m
electron-forge:lifecycle Process Succeeded: Packaging Application +4s
What command line arguments are you passing?
DEBUG=electron-forge* electron-forge package
What does your config.forge
data in package.json
look like?
const path = require('path')
module.exports = {
"make_targets": {
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
},
"electronPackagerConfig": {
"asar": true,
"protocol": "teamrepo://",
"icon": path.resolve(__dirname, "./src/icon")
},
"electronWinstallerConfig": {
"name": "my_new_project"
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"github_repository": {
"owner": "",
"name": ""
},
"windowsStoreConfig": {
"packageName": "",
"name": "mynewproject"
}
}
Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init
is a good starting point, if that is not the
source of your problem.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Also, sometimes the OS’s icon cache does weird things.
Hey @malept just to be sure, when I meant size, I meant the dimensions of height and width. I’m not sure if it is an Apple restriction or not, but by my trial and error above changing it to 512x512 resolved it.