Skip to content

[macOS][AtomVoice] 下载并编译 AtomVoice #37

@nzcv

Description

@nzcv

[macOS][AtomVoice] 下载并编译 AtomVoice

从 GitHub 克隆 BlackSquarre/AtomVoice,在本机 macOS 上完成 Swift 编译与打包;make dev 因 Makefile 中硬编码的开发者证书失败,改用手动 bundle + 本机证书签名成功。

环境

  • macOS 14+(本机:darwin 25.4.0)
  • Xcode 26.5 / Swift 6.3.2
  • 架构:Apple Silicon (arm64)

克隆仓库

cd /Users/yiluoyang/Documents/2026_06
git clone https://github.com/BlackSquarre/AtomVoice.git
cd AtomVoice

官方编译方式

README 推荐:

make dev
open dist/Test/AtomVoice.app

遇到的问题

swift build 编译成功,但 make devcodesign 阶段失败:

codesign --force --sign "Apple Development: miaolingru@gmail.com (XJS89V9J9T)" ...
Apple Development: miaolingru@gmail.com (XJS89V9J9T): no identity found
make: *** [dev] Error 1

原因:Makefile 第 163 行 bundle_app 宏中写死了原作者的 Apple Development 证书,本机不存在该 identity。

解决方案

  1. Swift 编译(已成功):
swift build -c release --product AtomVoice -Xswiftc -DDEBUG_BUILD
  1. 查看本机可用签名证书:
security find-identity -v -p codesigning

本机可用:

  • Apple Development: LUOYANG YI (2EVDZ7844J)
  • Apple Distribution: LUOYANG YI (TB8YV4RNJT)
  1. 手动 bundle + 签名(替代 make dev 的 bundle 步骤):
APP_NAME=AtomVoice
SRC_DIR=Sources/AtomVoice
TARGET="dist/Test/AtomVoice.app"
BINARY=".build/release/AtomVoice"

rm -rf "$TARGET"
mkdir -p "$TARGET/Contents/MacOS" "$TARGET/Contents/Resources"
cp "$BINARY" "$TARGET/Contents/MacOS/$APP_NAME"
cp "$SRC_DIR/Info.plist" "$TARGET/Contents/Info.plist"
cp "$SRC_DIR/AppIcon.icns" "$TARGET/Contents/Resources/AppIcon.icns"
cp -R Resources/*.lproj "$TARGET/Contents/Resources/"
cp -R Resources/Icons "$TARGET/Contents/Resources/"
find "$TARGET/Contents/Resources" -name "*.strings" | while read f; do
  printf '\xef\xbb\xbf' > "$f.tmp" && cat "$f" >> "$f.tmp" && mv "$f.tmp" "$f"
done

codesign --force --sign "Apple Development: LUOYANG YI (2EVDZ7844J)" \
  --entitlements AtomVoice.entitlements "$TARGET"

编译结果

版本 0.10.7-Beta-1
应用路径 AtomVoice/dist/Test/AtomVoice.app
架构 arm64
二进制大小 ~2.6 MB

运行

open dist/Test/AtomVoice.app

若 Gatekeeper 拦截(项目未 notarize):

xattr -cr dist/Test/AtomVoice.app

或右键 → 打开打开

后续建议

  • 修改 Makefile 中 bundle_app--sign 为本机证书,或通过环境变量 / CODESIGN_IDENTITY 注入,避免每次手动打包。
  • 正式发版可用 make release(需正确配置签名身份)。

推荐组合

git clone https://github.com/BlackSquarre/AtomVoice.git && cd AtomVoice
swift build -c release --product AtomVoice -Xswiftc -DDEBUG_BUILD
# 手动 bundle + codesign(见上文),或改 Makefile 后 make dev
open dist/Test/AtomVoice.app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions