Skip to content

Commit add35bb

Browse files
committed
fix: improve macOS code signing to resolve Gatekeeper warnings
- Add runtime hardening and timestamp to codesign - Remove quarantine attributes with xattr -cr before signing - Add signature verification steps for debugging - Enhance installation instructions for Gatekeeper warnings - Provide both GUI and command-line solutions for users This addresses the 'Apple cannot verify' security warnings that appeared after adding the app icon and modifying the build process.
1 parent f3aac0a commit add35bb

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,20 @@ jobs:
148148
run: |
149149
# 设置执行权限
150150
chmod +x dist/MacVimSwitch.app/Contents/MacOS/macvimswitch
151-
# 使用自签名
152-
codesign --force --deep --sign - --entitlements entitlements.plist dist/MacVimSwitch.app
151+
152+
# 使用更安全的签名方式
153+
# 移除属性标签(避免 quarantine 问题)
154+
xattr -cr dist/MacVimSwitch.app
155+
156+
# 使用 adhoc 签名(比完全自签名更安全)
157+
codesign --force --deep --sign - --entitlements entitlements.plist \
158+
--options runtime --timestamp dist/MacVimSwitch.app
159+
160+
# 验证签名
161+
codesign --verify --verbose dist/MacVimSwitch.app
162+
163+
# 显示签名信息
164+
codesign -dv dist/MacVimSwitch.app
153165
154166
- name: Create DMG
155167
run: |
@@ -185,13 +197,25 @@ jobs:
185197
186198
Universal Binary (支持 Intel 和 Apple Silicon Mac)
187199
188-
安装方法:
200+
## 安装方法(重要):
201+
202+
**由于 macOS 安全策略,初次安装可能需要以下步骤:**
203+
204+
### 方法1:标准安装(推荐)
189205
1. 双击打开 DMG 文件
190206
2. 将 MacVimSwitch 拖入 Applications 文件夹
191-
3. 从 Applications 文件夹打开 MacVimSwitch
192-
193-
使用说明:
194-
1. 在系统偏好设置中授予必要权限(如果你从 v0.6.3 之前老版本升级到新版本,你需要先删除原来的应用权限,再重新授权)
207+
3. **右键点击** MacVimSwitch.app → 选择 "打开"
208+
4. 点击 "打开" 确认信任该应用
209+
210+
### 方法2:命令行解除(高级用户)
211+
```bash
212+
# 在终端中运行(请修改为实际路径)
213+
sudo xattr -rd com.apple.quarantine /Applications/MacVimSwitch.app
214+
```
215+
216+
### 系统设置步骤:
217+
1. 在系统偏好设置中授予必要权限
218+
2. 如果从 v0.6.3 之前旧版本升级,需要先删除原来的应用权限,再重新授权
195219
196220
SHA256: ${{ env.DMG_SHA256 }}
197221

0 commit comments

Comments
 (0)