Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Current version of codesigner script I'm trying to use to sign Electron apps for use on OS X (not MAS).
# Invoke this script with a relative `.app` path
# EX:
# "dist/osx/MyApp-darwin-x64/"
# I had better luck using the iPhoneOS codesign_allocate
export CODESIGN_ALLOCATE="/Applications/"
#export CODESIGN_ALLOCATE="/Applications/"
# Next two are specified in Apple docs:
# export CODESIGN_ALLOCATE="/Applications/"
# export CODESIGN_ALLOCATE="/Applications/"
# However, neither worked, and gave error:
# /Users/JoshBavari/Development/ionic-gui/dist/osx/MyApp-darwin-x64/ Framework.framework/Electron Framework: cannot find code object on disk
#Run the following to get a list of certs
# security find-identity
identity="Developer ID Application: [My dev ID goes here]"
echo "### signing frameworks"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Electron Framework"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Versions/A"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Electron Framework"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/FilterIt Helper Helper EH"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/FilterIt Helper Helper NP"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/FilterIt Helper Helper NP"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/FilterIt Helper"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Mantle.framework/Mantle"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Mantle.framework/Versions/A"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Squirrel.framework/Squirrel"
codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Frameworks/Squirrel.framework/Versions/A"
#codesign --deep --force --verify --verbose --sign "$identity" "$app/Contents/Resources/app/js/main/phantom-resources/phantomjsosx"
echo "### signing app"
codesign --deep --force --verify --verbose --sign "$identity" "$app"
echo "### Zipping app"
ditto -c -k --sequesterRsrc --keepParent "$app" "$"
echo "### verifying signature",
codesign -vvvv -d "$app"
sudo spctl -a -vvvv "$app"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment