Run Godot from the macOS Terminal
A quick zsh function for running Godot from the macOS terminal when the app bundle is not already in your PATH.
I wanted to type godot in my terminal and get on with it.
On macOS, that is slightly annoying if you downloaded Godot as an app. The executable is not sitting directly in /Applications. It is inside the .app bundle, which is really a directory.
The path usually looks like this:
/Applications/Godot.app/Contents/MacOS/GodotOn my machine, the app was named Godot 2.app, so my path was this instead:
/Applications/Godot 2.app/Contents/MacOS/GodotCheck your exact app name before copying the command. If you renamed the bundle, the path has to match.
Add a zsh function
Add this to ~/.zshrc:
godot() {
"/Applications/Godot 2.app/Contents/MacOS/Godot" "$@"
}Change Godot 2.app to whatever your app bundle is called.
I prefer a function over an alias here because "$@" forwards arguments cleanly. That means --version, --path, --headless, export flags, and the rest behave like they would with a normal binary.
Reload your shell config and test it:
source "$HOME/.zshrc"
type -a godot
godot --version | head -n 1In my case, godot --version returned:
4.6.2.stableThat is all I needed.
If it still fails, check these three things:
- The app path matches the real bundle name in
/Applications - You edited the shell file your terminal actually loads, usually
~/.zshrc type -a godotshows the function instead of an old alias or command
The official Godot command line docs also mention Homebrew as an option on macOS. If you install Godot that way, godot can be added to your PATH automatically. I used the function because it fixed the downloaded app I already had.
