Up to date

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

Экспорт для macOS

См.также

This page describes how to export a Godot project to macOS. If you're looking to compile editor or export template binaries from source instead, read Compiling for macOS.

macOS apps exported with the official export templates are exported as a single "Universal 2" binary .app bundle, a folder with a specific structure which stores the executable, libraries and all the project files. This bundle can be exported as is, packed in a ZIP archive or DMG disk image (only supported when exporting from a computer running macOS). Universal binaries for macOS support both Intel x86_64 and ARM64 (Apple silicon, i.e. M1) architectures.

Требования

  • Загрузите шаблоны экспорта Godot. Используйте меню Godot: Editor > Manage Export Templates.

  • Действительный и уникальный идентификатор Bundle должен быть установлен в разделе Application вариантов экспорта.

Предупреждение

Проекты, экспортируемые без подписи кода и нотариализации, будут заблокированы Gatekeeper, если они будут загружены из неизвестных источников, см.:ref:Запуск Godot приложения на macOS <doc_running_on_macos> для получения дополнительной информации.

Code signing and notarization

По умолчанию macOS будет запускать только приложения, которые подписаны и нотариально заверены. Если вы используете любую другую конфигурацию подписи, см.:ref:Запуск Godot-приложения на macOS <doc_running_on_macos> для обходов.

Чтобы зафиксировать приложение, вы ** должны иметь действительный Apple Developer ID Certificate.

If you have an Apple Developer ID Certificate and exporting from macOS

Install Xcode command line tools and open Xcode at least once or run the sudo xcodebuild -license accept command to accept license agreement.

To sign exported app

  • Select Xcode codesign in the Code Signing > Codesign option.

  • Set valid Apple ID certificate identity (certificate "Common Name") in the Code Signing > Identity section.

To notarize exported app

  • Select Xcode altool in the Notarization > Notarization option.

  • Disable the Debugging entitlement.

  • Set valid Apple ID login / app. specific password or App Store Connect API UUID / Key in the Notarization section.

Вы можете использовать команду xcrun notarytool History для проверки статуса нотариального заверения и использовать команду xcrun notarytool log {ID} для загрузки журнала нотариального заверения.

Если у вас возникли проблемы с нотариальным заверением, дополнительную информацию см. в разделе «Решение распространённых проблем с нотариальным заверением <https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolve_common_notarization_issues>».

После завершения нотариального заверения прикрепите билет к экспортированному проекту.

If you have an Apple Developer ID Certificate and exporting from Linux or Windows

Install PyOxidizer rcodesign, and configure the path to rcodesign in the Editor Settings > Export > macOS > rcodesign.

To sign exported app

  • Select PyOxidizer rcodesign in the Code Signing > Codesign option.

  • Set valid Apple ID PKCS #12 certificate file and password in the Code Signing section.

To notarize exported app

  • Select PyOxidizer rcodesign in the Notarization > Notarization option.

  • Disable the Debugging entitlement.

  • Set valid App Store Connect API UUID / Key in the Notarization section.

You can use the rcodesign notary-log command to check notarization status.

After notarization is completed, use the rcodesign staple command to staple the ticket to the exported project.

Если у вас нет сертификата Apple Developer ID

  • Select Built-in (ad-hoc only) in the Code Signing > Codesign option.

  • Select Disabled in the Notarization > Notarization option.

In this case Godot will use a ad-hoc signature, which will make running an exported app easier for the end users, see the Running Godot apps on macOS page for more information.

Signing Options

Option

Описание

Codesign

Tool to use for code signing.

Identity

The "Full Name" or "Common Name" of the signing identity, store in the macOS keychain. 1

Certificate File

The PKCS #12 certificate file. 2

Certificate Password

Password for the certificate file. 2

Custom Options

Array of command line arguments passed to the code signing tool.

1

This option is visible only when signing with Xcode codesign.

2(1,2)

These options are visible only when signing with PyOxidizer rcodesign.

Notarization Options

Option

Описание

Notarization

Tool to use for notarization.

Имя Apple ID

Apple ID account name (email address). 3

Пароль Apple ID

Apple ID app-specific password. See Using app-specific passwords to enable two-factor authentication and create app password. 3

Apple ID команды

Team ID ("Organization Unit"), if your Apple ID belongs to multiple teams (optional). 3

API UUID

Apple App Store Connect API issuer UUID.

API Key

Apple App Store Connect API key.

Примечание

You should set either Apple ID Name/Password or App Store Connect API UUID/Key.

3(1,2,3)

These options are visible only when notarizing with Xcode altool.

Дополнительную информацию см. в разделе Заверение программного обеспечения macOS перед распространением.

Entitlements

Усиленные права во время выполнения

Усиленные права среды выполнения управляют параметрами безопасности и политикой доступа к ресурсам. Дополнительную информацию см. в разделе Hardened Runtime.

Entitlement

Описание

Allow JIT Code Execution 4

Allows creating writable and executable memory for JIT code. If you are using add-ons with dynamic or self-modifying native code, enable them according to the add-on documentation.

Allow Unsigned Executable Memory 4

Позволяет создавать записываемую и исполняемую память без ограничений JIT. Если вы используете надстройки с динамическим или самоизменяющимся собственным кодом, включите их в соответствии с документацией надстройки.

Allow DYLD Environment Variables 4

Allows app to uss dynamic linker environment variables to inject code. If you are using add-ons with dynamic or self-modifying native code, enable them according to the add-on documentation.

Отключить валидацию библиотеки

Allows app to load arbitrary libraries and frameworks. Enable it if you are using GDExtension add-ons or ad-hoc signing, or want to support user-provided external add-ons.

Аудио вход

Включите, если вам нужно использовать микрофон или другие источники аудиовхода. Если он включен, вы также должны указать сообщение об использовании в опции privacy/microphone_usage_description.

Камера

Включите, если вам нужно использовать камеру. Если она включена, вы также должны указать сообщение об использовании в опции privacy/camera_usage_description.

Расположение

Включите, если вам нужно использовать информацию о местоположении из служб определения местоположения. Если она включена, вы также должны указать сообщение об использовании в опции privacy/location_usage_description.

Адресная книга

5 Enable to allow access contacts in the user's address book, if it's enabled you should also provide usage message in the privacy/address_book_usage_description option.

Календари

5 Enable to allow access to the user's calendar, if it's enabled you should also provide usage message in the privacy/calendar_usage_description option.

Photo Library

5 Enable to allow access to the user's Photos library, if it's enabled you should also provide usage message in the privacy/photos_library_usage_description option.

Apple события

5 Enable to allow app to send Apple events to other apps.

Отладка

6 You can temporarily enable this entitlement to use native debugger (GDB, LLDB) with the exported app. This entitlement should be disabled for production export.

4(1,2,3)

Права Разрешить выполнение кода JIT, Разрешить неподписанную исполняемую память и Разрешить переменные среды DYLD всегда включены для экспорта Godot Mono и не отображаются в параметрах экспорта.

5(1,2,3,4)

Эти функции не поддерживаются Godot по умолчанию, включайте их только в том случае, если вы используете дополнения, которые их требуют.

6

Чтобы заверить приложение, вы должны отключить право Debugging.

Право на песочницу приложения

Приложение Sandbox ограничивает доступ к пользовательским данным, сетями и устройствам. Приложения, запущенные в Sandbox, не могут получить доступ к большей части файловой системы, не могут использовать пользовательские файлы диалогов и выполнять бинарные файлы (с использованием OS.execute и OS.create_process) за пределами пакета .app. Смотрите App Sandbox для получения дополнительной информации.

Примечание

To distribute an app through the App Store, you must enable the App Sandbox.

Entitlement

Описание

Включено

Enables App Sandbox.

Сетевой сервер

Включите, чтобы приложение могло прослушивать входящие сетевые подключения.

Сетевой клиент

Включите, чтобы разрешить приложению устанавливать исходящие сетевые подключения.

Устройство USB

Включите, чтобы разрешить приложению взаимодействовать с USB-устройствами. Это право необходимо для использования проводных контроллеров.

Устройство Bluetooth

Включить, чтобы разрешить приложению взаимодействовать с Bluetooth устройствами. Это разрешение требуется для использования беспроводных контроллеров.

Files Downloads 7

Разрешает доступ для чтения или записи в папку пользователя "Загрузки".

Files Pictures 7

Allows read or write access to the user's "Pictures" folder.

Files Music 7

Разрешает доступ для чтения или записи в папку пользователя "Музыка".

Files Movies 7

Разрешает доступ для чтения или записи в папку пользователя "Видео".

Files User Selected 7

Разрешает доступ для чтения или записи к произвольной папке. Чтобы получить доступ, пользователь должен выбрать папку в собственном диалоговом окне файла.

Вспомогательный исполняемый файл

Список вспомогательных исполняемых файлов для внедрения в пакет приложения. Приложение в песочнице может выполнять только эти исполняемые файлы.

7(1,2,3,4,5)

При желании вы можете предоставить сообщения об использовании для различных папок в параметрах privacy/*_folder_usage_description.

Примечание

Вы можете переопределить права по умолчанию, выбрав собственный файл разрешений; в этом случае все остальные права игнорируются.

Environment variables

You can use the following environment variables to set export options outside of the editor. During the export process, these override the values that you set in the export menu.

macOS export environment variables

Export option

Environment variable

Encryption / Encryption Key

GODOT_SCRIPT_ENCRYPTION_KEY

Options / Codesign / Certificate File

GODOT_MACOS_CODESIGN_CERTIFICATE_FILE

Options / Codesign / Certificate Password

GODOT_MACOS_CODESIGN_CERTIFICATE_PASSWORD

Options / Codesign / Provisioning Profile

GODOT_MACOS_CODESIGN_PROVISIONING_PROFILE

Options / Notarization / API UUID

GODOT_MACOS_NOTARIZATION_API_UUID

Options / Notarization / API Key

GODOT_MACOS_NOTARIZATION_API_KEY

Options / Notarization / API Key ID

GODOT_MACOS_NOTARIZATION_API_KEY_ID

Options / Notarization / Apple ID Name

GODOT_MACOS_NOTARIZATION_APPLE_ID_NAME

Options / Notarization / Apple ID Password

GODOT_MACOS_NOTARIZATION_APPLE_ID_PASSWORD