exporting_for_macos.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. .. _doc_exporting_for_macos:
  2. Exporting for macOS
  3. ===================
  4. .. seealso::
  5. This page describes how to export a Godot project to macOS.
  6. If you're looking to compile editor or export template binaries from source instead,
  7. read :ref:`doc_compiling_for_osx`.
  8. macOS apps are exported as an ``.app`` bundle, a folder with a specific structure which stores the executable, libraries and all the project files.
  9. This bundle is packed in a ZIP archive or DMG disk image (only supported when exporting for macOS).
  10. Requirements
  11. ------------
  12. - To enable code signing and notarization, you must export from a computer running macOS with Xcode command line tools installed.
  13. - Download the Godot export templates. Use the Godot menu: ``Editor > Manage Export Templates``.
  14. .. warning::
  15. Projects exported without code signing and notarization will be blocked by Gatekeeper if they are downloaded from unknown sources, see the :ref:`Running Godot apps on macOS <doc_running_on_macos>` page for more information.
  16. Code signing and notarization
  17. -----------------------------
  18. By default, macOS will run only applications that are signed and notarized. If you use any other signing configuration, see :ref:`Running Godot apps on macOS <doc_running_on_macos>` for workarounds.
  19. To notarize an app, you **must** have a valid `Apple Developer ID Certificate <https://developer.apple.com/>`__.
  20. If you have an Apple Developer ID Certificate
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. - Enable ``Code Signing``, ``Notarization``, ``Hardened Runtime`` and ``Timestamp`` and disable the ``Debug`` entitlement.
  23. - Provide valid Apple ID credentials and certificate identity.
  24. If ``Notarization`` is enabled, Godot will automatically upload the exported project for notarization.
  25. You can use the ``xcrun notarytool history`` command to check notarization status and use the ``xcrun notarytool log {ID}`` command to download the notarization log.
  26. If you encounter notarization issues, see `Resolving common notarization issues <https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues>`__ for more info.
  27. After notarization is completed, `staple the ticket <https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow>`__ to the exported project.
  28. If you do not have an Apple Developer ID Certificate
  29. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. Keep ``Code Signing`` enabled and leave the ``Identity`` option empty, in this case Godot will use a ad-hoc signature, which will make running an exported app easier for the end users.
  31. Signing Options
  32. ~~~~~~~~~~~~~~~
  33. +------------------------------+---------------------------------------------------------------------------------------------------+
  34. | Option | Description |
  35. +==============================+===================================================================================================+
  36. | Enable | Enables code signing. |
  37. +------------------------------+---------------------------------------------------------------------------------------------------+
  38. | Identity | The "Full Name" or "Common Name" of the signing identity, store in the macOS key chain. [1]_ |
  39. +------------------------------+---------------------------------------------------------------------------------------------------+
  40. | Timestamp | Requests a timestamp server to authenticate the time of signing. Required for notarization. |
  41. +------------------------------+---------------------------------------------------------------------------------------------------+
  42. | Hardened Runtime | Enables "Hardened Runtime". Required for notarization. |
  43. +------------------------------+---------------------------------------------------------------------------------------------------+
  44. | Replace Existing Signature | Replaces existing signatures of the GDNative libraries and embedded helper executables. |
  45. +------------------------------+---------------------------------------------------------------------------------------------------+
  46. .. note::
  47. To notarize an app, you must enable the ``Hardened Runtime`` and ``Timestamp``.
  48. .. [1] Leave ``Identity`` option empty to use ad-hoc signature.
  49. Notarization Options
  50. ~~~~~~~~~~~~~~~~~~~~
  51. +--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | Option | Description |
  53. +====================+==============================================================================================================================================================================+
  54. | Enable | Enables automatic upload for notarization. |
  55. +--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | Apple ID Name | Apple ID account name (email address) |
  57. +--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | Apple ID Password | Apple ID app-specific password. See `Using app-specific passwords <https://support.apple.com/en-us/HT204397>`__ to enable two-factor authentication and create app password. |
  59. +--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | Apple Team ID | Team ID if your Apple ID belongs to multiple teams |
  61. +--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. See `Notarizing macOS Software Before Distribution <https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution?language=objc>`__ for more info.
  63. Entitlements
  64. ------------
  65. Hardened Runtime Entitlements
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. Hardened Runtime entitlements manage security options and resource access policy.
  68. See `Hardened Runtime <https://developer.apple.com/documentation/security/hardened_runtime?language=objc>`__ for more info.
  69. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | Entitlement | Description |
  71. +=======================================+==================================================================================================================================================================================================+
  72. | Allow JIT Code Execution [2]_ | 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. |
  73. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | Allow Unsigned Executable Memory [2]_ | 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. |
  75. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | Allow DYLD Environment Variables [2]_ | Allows app to uss dynamic linker environment variables to inject code. f you are using add-ons with dynamic or self-modifying native code, enable them according to the add-on documentation. |
  77. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | Disable Library Validation | Allows app to load arbitrary libraries and frameworks. Enabled it if you are using GDNative add-ons and ad-hoc signature, or want to support user-provided external add-ons. |
  79. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | Audio Input | 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. |
  81. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | Camera | 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. |
  83. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | Location | Enable if you need to use location information from Location Services, if it's enabled you should also provide usage message in the `privacy/location_usage_description` option. |
  85. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | Address Book | [3]_ 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. |
  87. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | Calendars | [3]_ 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. |
  89. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | Photo Library | [3]_ 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. |
  91. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | Apple Events | [3]_ Enable to allow app to send Apple events to other apps. |
  93. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | Debugging | [4]_ You can temporarily enable this entitlement to use native debugger (GDB, LLDB) with the exported app. This entitlement should be disabled for production export. |
  95. +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. .. [2] 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.
  97. .. [3] These features aren't supported by Godot out of the box, enable them only if you are using add-ons which require them.
  98. .. [4] To notarize an app, you must disable the ``Debugging`` entitlement.
  99. App Sandbox Entitlement
  100. ~~~~~~~~~~~~~~~~~~~~~~~
  101. The App Sandbox restricts access to user data, networking and devices.
  102. 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.
  103. See `App Sandbox <https://developer.apple.com/documentation/security/app_sandbox?language=objc>`__ for more info.
  104. .. note::
  105. To distribute an app through the App Store, you must enable the App Sandbox.
  106. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  107. | Entitlement | Description |
  108. +===================================+======================================================================================================================================+
  109. | Enabled | Enables App Sandbox. |
  110. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  111. | Network Server | Enable to allow app to listen for incoming network connections. |
  112. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  113. | Network Client | Enable to allow app to establish outgoing network connections. |
  114. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  115. | Device USB | Enable to allow app to interact with USB devices. This entitlement is required to use wired controllers. |
  116. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  117. | Device Bluetooth | Enable to allow app to interact with Bluetooth devices. This entitlement is required to use wireless controllers. |
  118. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  119. | Files Downloads [5]_ | Allows read or write access to the user's "Downloads" folder. |
  120. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  121. | Files Pictures [5]_ | Allows read or write access to the user's "Pictures" folder. |
  122. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  123. | Files Music [5]_ | Allows read or write access to the user's "Music" folder. |
  124. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  125. | Files Movies [5]_ | Allows read or write access to the user's "Movies" folder. |
  126. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  127. | Files User Selected [5]_ | Allows read or write access to arbitrary folder. To gain access, a folder must be selected from the native file dialog by the user. |
  128. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  129. | Helper Executable | List of helper executables to embedded to the app bundle. Sandboxed app are limited to execute only these executable. |
  130. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  131. .. [5] You can optionally provide usage messages for various folders in the `privacy/*_folder_usage_description` options.
  132. You can override default entitlements by selecting custom entitlements file, in this case all other entitlement are ignored.