Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

为 macOS 平台编译

备注

这个页面描述的是如何从源码编译 macOS 编辑器和导出模板二进制文件。如果你要找的是导出项目到 macOS,请阅读 为 macOS 导出

需求

在 macOS 下编译时,需要以下条件:

备注

If you have Homebrew installed, you can easily install SCons using the following command:

brew install scons

如果你还没有 Xcode 命令行工具,安装 Homebrew 也会自动进行获取。

Similarly, if you have MacPorts installed, you can easily install SCons using the following command:

sudo port install scons

参见

要获取编译所需的 Godot 源码,请参阅 获取源代码

有关 Godot 的 SCons 用法的一般概述,请参阅 构建系统介绍

编译

启动终端, 进入引擎源代码的根目录.

若要为英特尔(x86-64)架构的 Mac 编译,请使用:

scons platform=macos arch=x86_64

要为 Apple Silicon(ARM64)驱动的 Mac 编译,请使用:

scons platform=macos arch=arm64

如果要通过“Universal 2”二进制来同时支持这两种架构,请运行上述两个命令,然后使用 lipo 将它们打包在一起:

lipo -create bin/godot.macos.editor.x86_64 bin/godot.macos.editor.arm64 -output bin/godot.macos.editor.universal

If all goes well, the resulting binary executable will be placed in the bin/ subdirectory. This executable file contains the whole engine and runs without any dependencies. Executing it will bring up the Project Manager.

备注

如果你想为自己的 Godot 构建和官方发布使用单独的编辑器设置,你可以通过在 bin/ 文件夹中创建一个名为 ._sc__sc_ 的文件来启用