在开发macos应用的时候必须要对自己开发的应用进行签名才能使用, 下面介绍个人如何获取Apple开发签名证书.
必备条件, 你需要先安装 xcode , 注册一个苹果开发者账号 免费的就可以, 以下为获取流程
You need to create a cert through xcode. Additionally, you need to have an apple developer account:
go to Sign In - Apple and make sure you have accepted the terms.install xcode through the app store. Open it.On the accounts tab, add your apple id. Select it.Select Manage Certificates.Add whatever cert you are using. I am using a free account, so I did "Mac Development" Take note of the cert name.
打开xcode->preference
从xcode中获取并添加开发证书
接下来打开 钥匙串访问 即可导出p12证书
选择证书后导出即可获取 p12格式的apple 开发证书 myAppleDev.p12
myAppleDev.p12 开发证书全局配置
将下面的内容添加到 ~/.bash_profile文件中
# 导出的p12密钥保存的位置
export CSC_LINK=$HOME/myAppleDev.p12
# p12密钥导出时设置的密钥密码
export CSC_KEY_PASSWORD=xxxx
使配置生效
# 使设置生效
source ~/.bash_profile
codesign使用签名
codesign --deep --force --verbose --sign "Mac Developer: MY NAME (MY CODE)" node_modules/electron/dist/Electron.app
精彩链接
发表评论