Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

在 macOS 上调试

调试 Godot 编辑器

将调试器附加到具有签名的 macOS 进程上需要“com.apple.security.get-task-allow”授权,默认未启用,因为启用时 App 无法进行公证。如果你想要调试官方构建的编辑器,就需要使用正确的授权重新进行签名。

创建包含如下内容的 editor.entitlements 文本文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>com.apple.security.cs.allow-dyld-environment-variables</key>
        <true/>
        <key>com.apple.security.cs.allow-jit</key>
        <true/>
        <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
        <key>com.apple.security.cs.disable-executable-page-protection</key>
        <true/>
        <key>com.apple.security.cs.disable-library-validation</key>
        <true/>
        <key>com.apple.security.device.audio-input</key>
        <true/>
        <key>com.apple.security.device.camera</key>
        <true/>
        <key>com.apple.security.get-task-allow</key>
        <true/>
    </dict>
</plist>

然后使用以下命令对编辑器进行重新签名:

codesign -s - --deep --force --options=runtime --entitlements ./editor.entitlements ./path/to/Godot.app

调试导出的项目

要允许调试,请在导出时选择 codesign\debuggingcom.apple.security.get-task-allow)授权。选中后不支持公证,所以应该将其禁用。