Up to date

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

Exportation de macOS

Voir aussi

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 Compiler pour macOS.

macOS apps are exported as an .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).

Pré-requis

  • Téléchargez les modèles d'exportation Godot. Utilisez le menu Godot : Editor > Manage Export Templates.

  • Un Bundle identifier valide et unique doit être défini dans la section Application des options d'exportation.

Avertissement

Les projets exportés sans signature de code et sans notarisation seront bloqués par Gatekeeper s'ils sont téléchargés à partir de sources inconnues, voir la page Running Godot apps on macOS pour plus d'informations.

Signature et notarisation du code

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.

To notarize an app, you must have a valid 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.

Vous pouvez utiliser la commande xcrun notarytool history pour vérifier l'état de la notarisation et utiliser la commande xcrun notarytool log {ID} pour télécharger le journal de notarisation.

Si vous rencontrez des problèmes de notarisation, consultez Résolution des problèmes courants de notarisation pour plus d'informations.

Une fois la notarisation terminée, attachez le ticket au projet exporté.

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.

Si vous ne disposez pas d'un Apple Developer ID Certificate

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

Options de signature

Option

Description

Codesign

Tool to use for code signing.

Identité

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.

Options de notarisation

Option

Description

Notarization

Tool to use for notarization.

Nom Apple ID

Apple ID account name (email address). 3

Mot de passe Apple ID

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

Apple Team 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.

Note

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.

Voir Notarisation des logiciels macOS avant distribution pour plus d'informations.

Permissions

Droits d'exécution renforcés

Les droits Hardened Runtime gèrent les options de sécurité et la politique d'accès aux ressources. Voir Hardened Runtime pour plus d'informations.

Droit

Description

Allow JIT Code Execution 4

Permet de créer une mémoire inscriptible et exécutable pour le code JIT. Si vous utilisez des modules complémentaires avec du code natif dynamique ou auto-modifiant, activez-les conformément à la documentation du module complémentaire.

Allow Unsigned Executable Memory 4

Permet de créer une mémoire inscriptible et exécutable sans restrictions JIT. Si vous utilisez des modules complémentaires avec du code natif dynamique ou auto-modifiant, activez-les conformément à la documentation du module complémentaire.

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.

Désactiver la validation des librairies

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.

Entrée Audio

Activez cette option si vous avez besoin d'utiliser le microphone ou d'autres sources d'entrée audio. Si elle est activée, vous devez également fournir un message d'utilisation dans l'option privacy/microphone_usage_description.

Caméra

Activez si vous avez besoin d'utiliser la caméra, si c'est activé, vous devez également fournir un message d'utilisation dans l'option privacy/camera_usage_description.

Localisation

Activez cette option si vous avez besoin d'utiliser les informations de localisation des services de localisation. Si elle est activée, vous devez également fournir un message d'utilisation dans l'option privacy/location_usage_description.

Carnet d'Adresses

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.

Calendrier

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.

Bibliothèque photos

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.

Événements Apple

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

Débogage

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)

Les droits Autoriser l'exécution de code JIT, Autoriser la mémoire exécutable non signée et Autoriser les variables d'environnement DYLD sont toujours activés pour les exportations Godot Mono et ne sont pas visibles dans les options d'exportation.

5(1,2,3,4)

Ces fonctions ne sont pas prises en charge de base par Godot, ne les activez que si vous utilisez des modules complémentaires qui les nécessitent.

6

Pour authentifier une application, vous devez désactiver le droit Debugging.

Certificat de bac à sable (Sandbox)

L'App Sandbox restreint l'accès aux données, au réseau et aux périphériques de l'utilisateur. Les apps sandboxées ne peuvent pas accéder à la plupart du système de fichiers, ne peuvent pas utiliser les dialogues de fichiers personnalisés et exécuter des binaires (en utilisant OS.execute et OS.create_process) en dehors du bundle .app. Voir App Sandbox pour plus d'informations.

Note

Pour distribuer une application via l'App Store, vous devez activer l'App Sandbox.

Droit

Description

Activé

Active l'App Sandbox.

Serveur réseau

Activez cette option pour permettre à l'application d'écouter les connexions réseau entrantes.

Client réseau

Activez pour permettre à l'application d'établir des connexions réseau sortantes.

Périphérique USB

Activer pour permettre à l'application d'interagir avec les périphériques USB. Ce droit est nécessaire pour utiliser des contrôleurs filaires.

Périphérique Bluetooth

Activer pour permettre à l'application d'interagir avec les périphériques Bluetooth. Ce droit est nécessaire pour utiliser les contrôleurs sans fil.

Files Downloads 7

Autorise l'accès en lecture et écriture au dossier « Téléchargements » de l'utilisateur.

Files Pictures 7

Autorise l'accès en lecture et écriture au dossier « Photos » de l'utilisateur.

Files Music 7

Autorise l'accès en lecture et écriture au dossier « Musique » de l'utilisateur.

Files Movies 7

Autorise l'accès en lecture et écriture au dossier « Films » de l'utilisateur.

Files User Selected 7

Permet l'accès en lecture ou en écriture à un dossier arbitraire. Pour obtenir cet accès, l'utilisateur doit sélectionner un dossier dans la boîte de dialogue du fichier natif.

Helper Executable

Liste des exécutables d'aide à intégrer au paquet d'applications. Les applications sandboxées sont limitées à l'exécution de ces exécutables.

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

Vous pouvez éventuellement fournir des messages d'utilisation pour divers dossiers dans les options privacy/*_folder_usage_description.

Note

Vous pouvez remplacer les droits par défaut en sélectionnant le fichier des droits personnalisés. Dans ce cas, tous les autres droits sont ignorés.

Variables d'environnement

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