The easiest way to install gdenv
is by using the pre-built binaries. These can be manually downloaded and configured, but automated installation scripts are provided and recommended.
Alternatively, you can install gdenv
from source using the latest supported version of Go. See Install from source for more details.
⚠️ WARNING: It's good practice to inspect an installation script prior to execution. The scripts are included in this repository and can be reviewed prior to use.
curl https://raw.githubusercontent.com/coffeebeats/gdenv/main/scripts/install.sh | sh
If you're using Git BASH for Windows follow the recommended Linux/MacOS instructions.
❕ NOTE: In order to run scripts in PowerShell, the execution policy must not be
Restricted
. Consider running the following command if you encounterUnauthorizedAccess
errors when following these instructions. See Set-ExecutionPolicy documentation for details.Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Invoke-WebRequest `
-UseBasicParsing `
-Uri "https://raw.githubusercontent.com/coffeebeats/gdenv/main/scripts/install.ps1" `
-OutFile "./install-gdenv.ps1"; `
&"./install-gdenv.ps1"; `
Remove-Item "./install-gdenv.ps1"
❕ NOTE: The instructions below provide
bash
-specific commands for a Linux-based system. While these won't work in Powershell, the process will be similar.
-
Download a prebuilt binary from the corresponding GitHub release. Set
VERSION
,OS
, andARCH
to the desired values.VERSION=0.0.0 OS=linux ARCH=x86_64; \ curl -LO https://github.com/coffeebeats/gdenv/releases/download/v$VERSION/gdenv-$VERSION-$OS-$ARCH.tar.gz
-
Extract the downloaded archive. To customize the
gdenv
install location, setGDENV_HOME
to the desired location (defaults to$HOME/.gdenv
on Linux/MacOS).GDENV_HOME=$HOME/.gdenv; \ mkdir -p $GDENV_HOME/bin && \ tar -C $GDENV_HOME/bin -xf gdenv-$VERSION-$OS-$ARCH.tar.gz
-
Export the
GDENV_HOME
environment variable and add$GDENV_HOME/bin
toPATH
. Add the following to your shell profile script (e.g. in.bashrc
,.zshenv
,.profile
, or something similar).export GDENV_HOME="$HOME/.gdenv" export PATH="$GDENV_HOME/bin:$PATH"
gdenv
is a Go project and can be installed using go install
. This option is not recommended as it requires having the Go toolchain installed, it's slower than downloading a prebuilt binary, and there may be instability due to using a different version of Go than it was developed with.
go install github.com/coffeebeats/gdenv/cmd/gdenv@latest
go install github.com/coffeebeats/gdenv/cmd/gdenv-shim@latest
Once gdenv
and gdenv-shim
are installed a few things need to be configured. Follow the instructions below based on your operating system.
-
Export the
GDENV_HOME
environment variable and add$GDENV_HOME/bin
to thePATH
environment variable.Add the following to your shell's profile script/RC file:
export GDENV_HOME="$HOME/.gdenv" export PATH="$GDENV_HOME/bin:$PATH"
-
When installing from source the
gdenv-shim
binary is not renamed togodot
; that is only done as part of the build process for the published binaries. To resolve this and allow thegodot
command to route to the correct version of Godot, add a link from the installedgdenv-shim
binary togodot
:❕ NOTE: Make sure to restart your terminal after the previous step so that any changes to
$GDENV_HOME
have been updated.test ! -z $GDENV_HOME && \ command -v gdenv-shim >/dev/null 2>&1 && \ ln -s $(which gdenv-shim) $GDENV_HOME/bin/godot
-
Export the
GDENV_HOME
environment variable using the following:$GdEnvHomePath = "${env:LOCALAPPDATA}\gdenv" # Replace with whichever path you'd like. [System.Environment]::SetEnvironmentVariable("GDENV_HOME", $GdEnvHomePath, "User")
-
Add
$GDENV_HOME/bin
to yourPATH
environment variable:❕ NOTE: Make sure to restart your terminal after the previous step so that any changes to
$GDENV_HOME
have been updated.$PathParts = [System.Environment]::GetEnvironmentVariable("PATH", "User").Trim(";") -Split ";" $PathParts = $PathParts.where{ $_ -ne "${env:GDENV_HOME}\bin" } $PathParts = $PathParts + "${env:GDENV_HOME}\bin" [System.Environment]::SetEnvironmentVariable("PATH", $($PathParts -Join ";"), "User")
-
When installing from source the
gdenv-shim
binary is not renamed togodot
; that is only done as part of the build process for the published binaries. To resolve this and allow thegodot
command to route to the correct version of Godot, add a link from the installedgdenv-shim
binary togodot
:❕ NOTE: Make sure to restart your terminal after the previous step so that any changes to
$GDENV_HOME
and$PATH
have been updated.New-Item "${env:GDENV_HOME}\bin" -ItemType Directory -ea 0 New-Item -Path "${env:GDENV_HOME}\bin\godot.exe" -ItemType SymbolicLink -Value $((Get-Command gdenv-shim).Path)
If you encounter an error
New-Item: Administrator privilege required for this operation
then re-run the command in step 3 from a terminal with Administrator privileges.