Skip to content

Could not get code signature for running application #7476

@arkakkar

Description

@arkakkar
  • Electron version: 1.41
  • Operating system: osx

My certificate works fine when I package the app by running
"electron-packager . $npm_package_productName --app-version=$npm_package_version --version=1.4.1 --out=../mac_builds --ignore='^/builds$' --platform=darwin --arch=x64 --icon=./app/icons/mac.icns --tmpdir=false --osx-sign.identity='Mac Developer: Arjun Kakkar (HQ3PJX83VN)' --overwrite"

but throws the error when running npm start

Activity

MarshallOfSound

MarshallOfSound commented on Oct 4, 2016

@MarshallOfSound
Member

@arkakkar Sounds like you are using the autoUpdater API on a non-codesigned application. As per the autoUpdater documentation

http://electron.atom.io/docs/api/auto-updater/#macos

Note: Your application must be signed for automatic updates on macOS. This is a requirement of Squirrel.Mac.

MarshallOfSound

MarshallOfSound commented on Oct 4, 2016

@MarshallOfSound
Member

For further clarification, the packager signs your app. When you run npm start the pre-built Electron executable is not signed

arkakkar

arkakkar commented on Oct 4, 2016

@arkakkar
Author

How can I sign the electron executable so that auto updater runs fine when I use npm start with the source and not just after the app is packed so that I could also debug my code.
I want to debug the main process with the auto updater setFeedUrl set on a non packaged app like when I run from the terminal

arkakkar

arkakkar commented on Oct 4, 2016

@arkakkar
Author

The issue is resolved. Code signing electron executable working. Thanks

jsgv

jsgv commented on Mar 2, 2017

@jsgv

@arkakkar How did you sign the Electron executable?

rvillanueva

rvillanueva commented on Mar 9, 2017

@rvillanueva

@JesusGalvan https://github.com/electron-userland/electron-builder/wiki/Code-Signing

How to Export Certificate on macOS

Open Keychain.
Select login keychain, and My Certificates category.
Select all required certificates (hint: use cmd-click to select several):

Developer ID Application: to sign app for macOS.
3rd Party Mac Developer Application: and 3rd Party Mac Developer Installer: to sign app for MAS (Mac App Store).
Developer ID Application: and Developer ID Installer to sign app and installer for distribution outside of the Mac App Store.
Please note – you can select as many certificates, as need. No restrictions on electron-builder side. All selected certificates will be imported into temporary keychain on CI server.

Open context menu and Export.

jdell64

jdell64 commented on Oct 25, 2017

@jdell64

So, maybe this is too much information, but it took me a few hours to figure out how to sign the .app file. I'll list out what I did in the off chance it helps someone else (I am completely new at developing on a mac):

prereqs: you have electron-packager installed, you have electron-osx-sign installed, and you can build your target.

  1. You need to create a cert through xcode. Additionally, you need to have an apple developer account:
    1. go to https://developer.apple.com/account and make sure you have accepted the terms.
    2. install xcode through the app store. Open it.
    3. On the accounts tab, add your apple id. Select it.
    4. Select Manage Certificates.
    5. Add whatever cert you are using. I am using a free account, so I did "Mac Development"
      Take note of the cert name.
  2. You have a cert, now you can sign the app. Assuming you were able to build it (I built mine using something like: "electron-packager . $npm_package_productName --app-version=$npm_package_version --out=builds --platform=darwin --arch=x64 --overwrite",) you can run something like:
    "electron-osx-sign ./builds/$npm_package_productName-darwin-x64/$npm_package_productName.app/ --identity='Mac Developer: [my email] ([this code thing])'" (the name of the cert).

Again, sorry if that is not the original question, but I was stuck for a few hours.

phuze

phuze commented on Nov 22, 2017

@phuze

Although closed, this issue helped me out so I'm leaving some useful information for future readers.

To further clarify a few points in regards to @jdell64 post -- the Accounts tab can be accessed by first opening the Preferences window in XCode which can be found under the File menu.

The proper certificate name cannot be seen through XCode. Once you've added a certificate, you'll need to open Keygen Access.app (use Spotlight search), click My Certificates from the left menu. Here you will see your certificate.

For example:

Mac Developer: batman@marvel.com (123ABCDE45)

I will further add, that if you are using electron-builder to package your application, then you will need to export your certificates. Read more about code signing and exporting your certificates.

It is important to note with regards to auto updating, the use of a "Mac Development" certificate, to the best of my knowledge, would only enable auto updating on your own Mac. If you are releasing your application for others, you will need to add both Developer ID Application and Developer ID Installer certificates, which can only be added if you have a valid Developer ID which you get when you purchase a subscription to the Apple Developer Program.

erynkyo

erynkyo commented on Dec 19, 2017

@erynkyo

i met the same issue today .if you want to running by dev mode,you should sign electron.app.
step 1:create a new login type key in your mac.
step 2: go into your electron dist folder.ex:{project}/node_modules/electron/dist with cmd.
step 3:codesign --deep --force --verbose --sign "{your key name}" electron.app.
And then ,very thing will be ok.
ps:i am not good at english, forgive me :(

shanesmith

shanesmith commented on Jan 8, 2018

@shanesmith

Building on @erynkyo I've found that you don't need to create a new key and can ad-hoc code sign by providing just a dash for the --sign param

codesign --deep --force --verbose --sign - electron.app

zewa666

zewa666 commented on Mar 9, 2018

@zewa666

@shanesmith awesome solution.
For anyone searching for a way to sign your app during development, just use above to sign your node_modules/electron/dist/Electron.app and you should be good to go to debug the autoUpdater process

onassar

onassar commented on Mar 9, 2018

@onassar

Wow what a rabbit hole I went down to figure this out. Thanks everyone here for the pieces that got me to where I needed to go. The following is what I needed to do:

From within the app directory that electron-forge set up for me, I had to run the following:

codesign --deep --force --verbose --sign "Mac Developer: MY NAME (MY CODE)" node_modules/electron-prebuilt-compile/node_modules/electron/dist/Electron.app

This did the job for me (finally).

26 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mlynch@joshuapinter@shanesmith@onassar@jdell64

        Issue actions

          Could not get code signature for running application · Issue #7476 · electron/electron