Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can still find outdated information, please open an issue.

Compiling for macOS

Note

This page describes how to compile macOS editor and export template binaries from source. If you're looking to export your project to macOS instead, read Exporting for macOS.

Requirements

For compiling under macOS, the following is required:

Warning

If you are building the master branch, download and install the Vulkan SDK for macOS. This is required to compile Godot 4.x, as MoltenVK is used to translate Vulkan to Metal (macOS doesn't support Vulkan out of the box).

Note

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

brew install scons

Installing Homebrew will also fetch the Command Line Tools for Xcode automatically if you don't have them already.

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

sudo port install scons

See also

To get the Godot source code for compiling, see Getting the source.

For a general overview of SCons usage for Godot, see Introduction to the buildsystem.

Compiling

Start a terminal, go to the root directory of the engine source code.

To compile for Intel (x86-64) powered Macs, use:

scons platform=macos arch=x86_64

To compile for Apple Silicon (ARM64) powered Macs, use:

scons platform=macos arch=arm64

To support both architectures in a single "Universal 2" binary, run the above two commands and then use lipo to bundle them together:

lipo -create bin/godot.macos.tools.x86_64 bin/godot.macos.tools.arm64 -output bin/godot.macos.tools.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.

Note

If you want to use separate editor settings for your own Godot builds and official releases, you can enable Self-contained mode by creating a file called ._sc_ or _sc_ in the bin/ folder.

To create an .app bundle like in the official builds, you need to use the template located in misc/dist/macos_tools.app. Typically, for an optimized editor binary built with target=release_debug:

cp -r misc/dist/macos_tools.app ./Godot.app
mkdir -p Godot.app/Contents/MacOS
cp bin/godot.macos.opt.tools.universal Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot

Note

If you are building the master branch, you also need to include support for the MoltenVK Vulkan portability library. By default, it will be linked statically from your installation of the Vulkan SDK for macOS. You can also choose to link it dynamically by passing use_volk=yes and including the dynamic library in your .app bundle:

mkdir -p Godot.app/Contents/Frameworks
cp <Vulkan SDK path>/macOS/lib/libMoltenVK.dylib Godot.app/Contents/Frameworks/libMoltenVK.dylib

Running a headless/server build

To run in headless mode which provides editor functionality to export projects in an automated manner, use the normal build:

scons platform=macos target=editor

And then use the --headless command line argument:

./bin/godot.macos.editor.x86_64 --headless

To compile a debug server build which can be used with remote debugging tools, use:

scons platform=macos target=template_debug

To compile a release server build which is optimized to run dedicated game servers, use:

scons platform=macos target=template_release production=yes

Building export templates

To build macOS export templates, you have to compile using the targets without the editor: target=template_release (release template) and target=template_debug.

Official templates are universal binaries which support both Intel x86_64 and ARM64 architectures. You can also create export templates that support only one of those two architectures by leaving out the lipo step below.

  • For Intel x86_64:

    scons platform=macos target=template_release arch=x86_64
    scons platform=macos target=template_debug arch=x86_64
    
  • For ARM64 (Apple M1):

    scons platform=macos target=template_release arch=arm64
    scons platform=macos target=template_debug arch=arm64
    

To support both architectures in a single "Universal 2" binary, run the above two commands blocks and then use lipo to bundle them together:

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

To create an .app bundle like in the official builds, you need to use the template located in misc/dist/macos_template.app. The release and debug builds should be placed in macos_template.app/Contents/MacOS with the names godot_macos_release.64 and godot_macos_debug.64 respectively. You can do so with the following commands (assuming a universal build, otherwise replace the .universal extension with the one of your arch-specific binaries):