How to re-sign an app on a Mac

I recently changed the Info.plist file for so that it would stop using the discrete GPU. However, this seemed to introduce a new issue where, apparently due to my changes to the Info.plist, the code signature for the app was no longer valid:

Feb 18 00:28:54 bardiel amfid[260]: /Applications/ signature not valid: 0xfffefa2a
Feb 18 00:28:54 bardiel kernel[0]: proc 811: load code signature error 4 for file "nextcloud"
Feb 18 00:28:56 bardiel usernoted[269]: Failed to validate application at /Applications/ -67030
Feb 18 00:28:56 bardiel[83]: suppressing keychain prompt /Applications/; code signing check failed rc=-67030

This meant that the app was no longer allowed to access the Keychain, and the only way I found out was by inspecting system.log in Thus would ask me for a login every time it started - the primary symptom.

While waiting for the Nextcloud developers to work on the aforementioned issue, an interim fix is as follows:

  1. Follow this guide from Apple to "obtain a self-signed certificate using Certificate Assistant".
  2. Perform the following command in
    $ sudo codesign -s "My Certificate Name" -fv /Applications/

You should now be able to launch the app and have it prompt you for Keychain access.

Last modified on 18 Feb 2019 at 12:51:03 AM ET