Skip to content

fix: macOS arm64ビルドのad-hoc署名を無効化してコード署名エラーを修正#2821

Merged
sevenc-nanashi merged 3 commits intomainfrom
copilot/fix-macos-arm64-code-signing
Nov 4, 2025
Merged

fix: macOS arm64ビルドのad-hoc署名を無効化してコード署名エラーを修正#2821
sevenc-nanashi merged 3 commits intomainfrom
copilot/fix-macos-arm64-code-signing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 2, 2025

electron-builder 26.1.0から、arm64/universalビルドで証明書がない場合に自動的にad-hoc署名が実行されるようになった。現在の構成ではREADME.txtContents/MacOS/に配置されており、ad-hoc署名の検証が厳格化されたことで非実行ファイルの存在がエラーとして検出される。

変更内容

build/electronBuilderConfig.tsmacセクションにidentity: nullを追加してad-hoc署名を無効化:

mac: {
  // ...
  identity: null,  // ad-hoc署名を無効化
},

これによりarm64ビルドもx64ビルドと同様に署名をスキップし、ビルドが成功する。

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • npm.jsr.io
    • Triggering command: node /usr/local/bin/pnpm install --frozen-lockfile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>macOS arm64ビルドがコード署名エラーで失敗する (electron-builder 26.1.0)</issue_title>
<issue_description>## 不具合の内容

electron-builderを26.1.0に更新後、macOS arm64ビルドのみがコード署名エラーで失敗する

現象・ログ

GitHub Actions の macOS arm64 ビルドが以下のエラーで失敗:

• falling back to ad-hoc signature for macOS application code signing
⨯ Command failed: codesign --sign - --force --timestamp ...
/Contents/MacOS/VOICEVOX: code object is not signed at all
In subcomponent: /Contents/MacOS/README.txt
  • 失敗: macOS 14 (macos-14) での arm64 ビルド
  • 成功: macOS 15 (macos-15-intel) での x64 ビルド

再現手順

  1. コミット a1940801 (2025-10-31) 以降の main ブランチをビルド
  2. GitHub Actions の build-and-upload (macos-cpu-arm64-prepackage, ...) ジョブを確認

失敗例: https://github.com/VOICEVOX/voicevox/actions/runs/18990104333/job/54258692610

期待動作

26.0.12 と同様に、arm64 ビルドも成功する

原因

1. electron-builder 26.1.0 の変更

コミット a1940801 で electron-builder 26.0.12 → 26.1.0 に更新

2. PR VOICEVOX/voicevox#9007 の影響

electron-builder 26.1.0 に含まれる PR VOICEVOX/voicevox#9007 により、arm64/universal ビルドで証明書がない場合、自動的に ad-hoc 署名を実行するように変更された

// macPackager.ts L316
const fallBackToAdhoc = (arch === Arch.arm64 || arch === Arch.universal) && !this.forceCodeSigning
  • x64: ad-hoc 署名をスキップ → エラーなし
  • arm64: ad-hoc 署名を実行 → エラー発生

3. 既存の設定問題が顕在化

build/electronBuilderConfig.ts:46:

const extraFilePrefix = isMac ? "MacOS/" : "";

この設定により、README.txtContents/MacOS/ に配置される。
macOS アプリバンドルでは Contents/MacOS/ は実行可能ファイルのみを配置すべきだが、非実行ファイル(README.txt)が含まれている。

4. 検証の厳格化

26.1.0 で更新された @electron/osx-sign 1.3.3 (PR VOICEVOX/voicevox#345) により strictVerify が修正され、コード署名検証が厳格化。

これにより、ad-hoc 署名実行時に Contents/MacOS/README.txt が検出されエラーとなる。

VOICEVOXのバージョン

999.999.999-develop (main ブランチ)

OSの種類/ディストリ/バージョン

  • macOS

GitHub Actions:

  • 失敗: macOS 14 (macos-14) - arm64
  • 成功: macOS 15 (macos-15-intel) - x64</issue_description>

<agent_instructions>実装してください。
PRタイトルやコミットメッセージは説明は日本語で。
かつタイトルとコミットメッセージは他のPRのタイトルを参考にしつつ、contentional commit messageにしてください。</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@Hiroshiba 最適な解決策はおそらく `identity: null`

修正方法

build/electronBuilderConfig.tsに以下を追加:

mac: {
  artifactName: MACOS_ARTIFACT_NAME || undefined,
  icon: "build/icons/icon-mac.png",
  category: "public.app-category.utilities",
  target: [
    {
      target: "dmg",
      arch: [isArm64 ? "arm64" : "x64"],
    },
  ],
  identity: null,  // ad-hoc署名を無効化
},

デメリットとして、adhoc署名すらしないのでGatekeeperとかに弾かれやすいかも。
でも調べた感じadhoc署名の有無だけではなにもかわらないかも・・・?

これが良さそうな理由

Details

1. README.txtだけを移動しても不十分

Contents/MacOS/には実行可能ファイルのみを配置すべきですが、現在の構成では:

  • MacOS/README.txt ← 今回のエラー
  • MacOS/vv-engine/engine_manifest.json
  • MacOS/vv-engine/licenses.json
  • MacOS/vv-engine/base_library.zip

など、多数の非実行ファイルが含まれています。README.txtResources/に移動しても、次はvv-engine/内のファイルで同じエラーが発生する可能性が高いです。

2. vv-engine/全体の再構成は大規模な変更

macOSのベストプラクティスに完全準拠するには:

  • 非実行ファイル → Contents/Resources/
  • .dylibContents/Frameworks/
  • 実行ファイルのみ → Contents/MacOS/

しかし、これには:

  • getSevenZipPath()getAppPaths()などのパス参照を変更
  • defaultEngineDirの解決方法を変更
  • 場合によってはシンボリックリンクを使った段階的な移行

など、広範囲なコード変更が必要です。

3. identity: nullは26.0.12の動作に戻す

  • electron-builder 26.0.12: 証明書がない場合、arm64でも署名をスキップ
  • electron-builder 26.1.0: 証明書がない場合、arm64でad-hoc署名にフォールバック
  • electron-builder 26.1.0 + identity: null: 26.0.12と同じ動作に戻る

他の解決策(+推奨しない理由)

Details

strictVerify: false

  • ❌ 効果なし。strictVerifyは署名後の検証時に使われるが、エラーは署名時に発生

README.txtのみ移動

  • ❌ 不完全。vv-engine/内の非実行ファイルが次のエラーを引き起こす可能性

完全なバンドル再構成

  • ⚠️ 理想的だが、大規模な変更が必要で開発コストが高い

長期的にはmacOSアプリバンドル構造を適切に再構成しつつ、署名したほうが良い。
うまくいくか不明だけど、例えばこういう感じとか?

  1. extraResourcesを使って非実行ファイルをResources/に配置
  2. .dylibFrameworks/に配置
  3. コード内のパス参照をprocess.resourcesPathを使うように変更
  4. 移行期間中はMacOS/からシンボリックリンクで対応

このあたりの議論も近いかも: #2112</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Hiroshiba <4987327+Hiroshiba@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code signing error in macOS arm64 build fix: macOS arm64ビルドのad-hoc署名を無効化してコード署名エラーを修正 Nov 2, 2025
Copilot AI requested a review from Hiroshiba November 2, 2025 19:30
Comment thread build/electronBuilderConfig.ts Outdated
@Hiroshiba Hiroshiba requested a review from Copilot November 2, 2025 19:42
@Hiroshiba Hiroshiba marked this pull request as ready for review November 2, 2025 19:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR disables code signing for macOS builds by setting the identity to null, effectively preventing ad-hoc signing.

  • Added identity: null configuration to the macOS build settings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/electronBuilderConfig.ts
@voicevox-preview-pages
Copy link
Copy Markdown

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:586e912

Copy link
Copy Markdown
Member

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

特に問題なさそう。

@sevenc-nanashi sevenc-nanashi added this pull request to the merge queue Nov 4, 2025
Merged via the queue into main with commit 07dd98e Nov 4, 2025
25 checks passed
@Hiroshiba Hiroshiba deleted the copilot/fix-macos-arm64-code-signing branch November 7, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS arm64ビルドがコード署名エラーで失敗する (electron-builder 26.1.0)

4 participants