running_on_macos.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .. _doc_running_on_macos:
  2. Running Godot apps on macOS
  3. ===========================
  4. .. seealso::
  5. This page covers running Godot projects on macOS.
  6. If you haven't exported your project yet, read :ref:`doc_exporting_for_macos` first.
  7. By default, macOS will run only applications that are signed and notarized.
  8. .. note::
  9. When running an app from the Downloads folder or when still in quarantine,
  10. Gatekeeper will perform *path randomization* as a security measure.
  11. This breaks access to relative paths from the app, which the app relies upon to work.
  12. To resolve this issue, move the app to the ``/Applications`` folder.
  13. In general, macOS apps should avoid relying on relative paths from the
  14. application folder.
  15. Depending on the way a macOS app is signed and distributed, the following scenarios are possible:
  16. App is signed, notarized and distributed via App Store
  17. ------------------------------------------------------
  18. .. note::
  19. App developers need to join the Apple Developer Program, and configure signing and notarization options during export, then upload the app to the App Store.
  20. The app should run out of the box, without extra user interaction required.
  21. App is signed, notarized and distributed outside App Store
  22. ----------------------------------------------------------
  23. .. note::
  24. App developers need to join the Apple Developer Program, and configure signing and notarization options during export, then distribute the app as ".DMG" or ".ZIP" archive.
  25. When you run the app for the first time, the following dialog is displayed:
  26. .. image:: img/signed_and_notarized_0.png
  27. Click ``Open`` to start the app.
  28. If you see the following warning dialog, your Mac is set up to allow apps only from the App Store.
  29. .. image:: img/signed_and_notarized_1.png
  30. To allow third-party apps, open ``System Preferences``, click ``Security & Privacy``, then click ``General``, unlock settings, and select ``App Store and identified developers``.
  31. .. image:: img/sys_pref_0.png
  32. App is signed (including ad-hoc signatures) but not notarized
  33. -------------------------------------------------------------
  34. .. note::
  35. App developer used self-signed certificate or ad-hoc signing (default Godot behavior for exported project).
  36. When you run the app for the first time, the following dialog is displayed:
  37. .. image:: img/signed_0.png
  38. To run this app, you can temporarily override Gatekeeper:
  39. * Either open ``System Preferences``, click ``Security & Privacy``, then click ``General``, and click ``Open Anyway``.
  40. .. image:: img/sys_pref_1.png
  41. * Or, right-click (Control-click) on the app icon in the Finder window and select ``Open`` from the menu.
  42. .. image:: img/signed_1.png
  43. * Then click ``Open`` in the confirmation dialog.
  44. .. image:: img/signed_2.png
  45. * Enter your password if you're prompted.
  46. Another option is to disable Gatekeeper entirely. Note that this does decrease
  47. the security of your computer by allowing you to run any software you want.
  48. To do this, run ``sudo spctl --master-disable`` in the Terminal, enter your
  49. password, and then the **Anywhere** option will be available:
  50. .. image:: img/macos_allow_from_anywhere.png
  51. Note that Gatekeeper will re-enable itself when macOS updates.
  52. App is not signed, executable is linker-signed
  53. ----------------------------------------------
  54. .. note::
  55. App is built using official export templates, but it is not signed.
  56. When you run the app for the first time, the following dialog is displayed:
  57. .. image:: img/linker_signed_1.png
  58. To run this app, you should remove the quarantine extended file attribute manually:
  59. * Open ``Terminal.app`` (press :kbd:`Cmd + Space` and enter ``Terminal``).
  60. * Navigate to the folder containing the target application.
  61. Use the ``cd path_to_the_app_folder`` command, e.g. ``cd ~/Downloads/`` if it's in the ``Downloads`` folder.
  62. * Run the command ``xattr -dr com.apple.quarantine "Unsigned Game.app"`` (including quotation marks and ``.app`` extension).
  63. Neither app nor executable is signed (relevant for Apple Silicon Macs only)
  64. ---------------------------------------------------------------------------
  65. .. note::
  66. App is built using custom export templates, compiled using OSXCross, and it is not signed at all.
  67. When you run the app for the first time, the following dialog is displayed:
  68. .. image:: img/unsigned_1.png
  69. To run this app, you can ad-hoc sign it yourself:
  70. * Install ``Xcode`` for the App Store, start it and confirm command line tools installation.
  71. * Open ``Terminal.app`` (press :kbd:`Cmd + Space` and enter ``Terminal``).
  72. * Navigate to the folder containing the target application.
  73. Use the ``cd path_to_the_app_folder`` command, e.g. ``cd ~/Downloads/`` if it's in the ``Downloads`` folder.
  74. * Run the following commands:
  75. ``xattr -dr com.apple.quarantine "Unsigned Game.app"`` (including quotation marks and ".app" extension).
  76. ``codesign -s - --force --deep "Unsigned Game.app"`` (including quotation marks and ".app" extension).