question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maleptcommented, Feb 8, 2019

Also, sometimes the OS’s icon cache does weird things.

0reactions
jefflamcommented, Feb 21, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't get macOS icon to show up with packaged app ... - GitHub
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...
Read more >
Align and resize items in icon view on Mac - Apple Support
When viewing items in icon view, you can change the alignment, size, and labeling ... Align and sort icons once: Choose Clean Up...
Read more >
Fixed issues in InDesign - Adobe Support
Unable to show '&' in the file name inside the saveAs progress bar. ... [macOS only] InDesign application icon appears bigger in size...
Read more >
R for macOS FAQ - R Project
Next: How to install packages, Previous: Introduction, Up: R for macOS FAQ ... Next: The R Console, Previous: How to get R.app, Up:...
Read more >
Add a macOS DMG app to Microsoft Intune
... 2GB in size. The Microsoft Intune management agent for macOS is installed. ... In the App package file pane, select the browse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found