Up to date

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

Exportando para macOS

Ver também

Esta página descreve como exportar um projeto Godot para o macOS. Se você está procurando compilar editor ou exportar binários de modelo de origem, leia Compilando para macOS.

os aplicativos do macOS são exportados como um pacote .app, uma pasta com uma estrutura específica que armazena o executável, bibliotecas e todos os arquivos do projeto. Este pacote pode ser exportado como é, embalado em um arquivo ZIP ou imagem de disco DMG (somente suportado ao exportar de um computador executando o macOS).

Requisitos

  • Baixe os modelos de exportação Godot. Use o menu Godot: Editor > Gerenciar modelos de exportação.

  • A valid and unique Bundle identifier should be set in the Application section of the export options.

Aviso

Projects exported without code signing and notarization will be blocked by Gatekeeper if they are downloaded from unknown sources, see the Running Godot apps on macOS page for more information.

Assinatura de código e notarização

By default, macOS will run only applications that are signed and notarized. If you use any other signing configuration, see Running Godot apps on macOS for workarounds.

Para autenticar um aplicativo, você deve ter um Certificado de identificação de desenvolvedor da Apple válido.

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.

Você pode usar o comando xcrun notarytool history para verificar o status da notarização e usar o comando xcrun notarytool log {ID} para baixar o log de notarização .

Se você encontrar problemas de notarização, consulte Resolvendo problemas comuns de notarização para obter mais informações.

Após a conclusão da notarização, apresente o ticket no projeto exportado.

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.

Se você não tiver um certificado de ID de desenvolvedor da Apple

  • 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.

Opções de Assinatura

Opção

Descrição

Codesign

Tool to use for code signing.

Identidade

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.

Opções de Notarização

Opção

Descrição

Notarization

Tool to use for notarization.

Nome Apple ID

Apple ID account name (email address). 3

Senha Apple ID

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

ID Apple Team

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.

Nota

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.

Consulte Notarizing macOS Software Before Distribution para obter mais informações.

Direitos

Hardened Runtime Entitlements

Hardened Runtime entitlements manage security options and resource access policy. See Hardened Runtime for more info.

Entitlement

Descrição

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

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

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.

Desativar Validação da Biblioteca

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.

Entrada de Áudio

Enable if you need to use the microphone or other audio input sources, if it's enabled you should also provide usage message in the privacy/microphone_usage_description option.

Câmera

Enable if you need to use the camera, if it's enabled you should also provide usage message in the privacy/camera_usage_description option.

Localização

Habilite se você precisar usar as informações de localização dos Serviços de Localização, se estiver habilitado, você também deve fornecer a mensagem de uso na opção privacy/location_usage_description.

Contatos

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.

Calendários

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.

Biblioteca de Fotos

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.

Eventos Apple

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

Depuração

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)

The Allow JIT Code Execution, Allow Unsigned Executable Memory and Allow DYLD Environment Variables entitlements are always enabled for the Godot Mono exports, and are not visible in the export options.

5(1,2,3,4)

These features aren't supported by Godot out of the box, enable them only if you are using add-ons which require them.

6

To notarize an app, you must disable the Debugging entitlement.

App Sandbox Entitlement

The App Sandbox restricts access to user data, networking and devices. Sandboxed apps can't access most of the file system, can't use custom file dialogs and execute binaries (using OS.execute and OS.create_process) outside the .app bundle. See App Sandbox for more info.

Nota

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

Entitlement

Descrição

Habilitado

Enables App Sandbox.

Servidor de Rede

Enable to allow app to listen for incoming network connections.

Cliente de Rede

Enable to allow app to establish outgoing network connections.

Dispositivo USB

Permite que o aplicativo interaja com dispositivos USB. Este direito é necessário para usar controles com fio.

Bluetooth do Dispositivo

Habilite para permitir que o aplicativo interaja com dispositivos Bluetooth. Este direito é necessário para usar controles sem fio.

Download de Arquivos 7

Permite ler ou escrever acesso à pasta "Downloads" do usuário.

Arquivos de imagens 7

Permite o acesso para leitura ou escrever na pasta "Pictures" do usuário.

Arquivos de música 7

Permite o acesso para leitura ou escrever na pasta "Música" do usuário.

Arquivos Filmes 7

Permite o acesso para leitura ou escrever na pasta "Vídeos" do usuário.

Arquivos selecionados pelo usuário 7

Allows read or write access to arbitrary folder. To gain access, a folder must be selected from the native file dialog by the user.

Helper Executable

List of helper executables to embedded to the app bundle. Sandboxed app are limited to execute only these executable.

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

You can optionally provide usage messages for various folders in the privacy/*_folder_usage_description options.

Nota

You can override default entitlements by selecting custom entitlements file, in this case all other entitlement are ignored.

Variáveis de ambiente

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