Last updated: Apr 4, 2024
Reading time·3 min
The error "'go' is not recognized as an internal or external command, operable program or batch file" occurs for 2 main reasons:
go
executable in your system's PATH environment
variable.To install and configure Go:
In a new Command Prompt, issue the go version
command to make sure go
is
installed and in your PATH.
go version
If you still get the error that "'go' is not recognized as an internal or
external command", you have to add the path to the go
executable to your
system's PATH environment variable.
The default location of the go.exe
file is in the following directory.
C:\Program Files\Go\bin # 👇️ Might also be under Program Files (x86) C:\Program Files (x86)\Go\bin
go
executable in your system's PATH environment variableTo add the path to the go
executable in your system's PATH environment
variable:
The path on my machine is the following:
C:\Program Files\Go\bin # 👇️ might also be under Program Files (x86) C:\Program Files (x86)\Go\bin
If you can't find the PATH, try issuing the where go
command.
We are looking for the directory that contains the go.exe
file because this is
the file that is run when you issue go
commands.
go
executable file, add it and click on the
"OK" button twice to confirm.You might also have to restart your PC, but that's not always necessary.
In a new Command Prompt, issue the go version
command to make sure go
is
installed and in your PATH.
go version
After the path to the executable (go.exe
) has been added to your system's PATH
environment variable, the go
command should work.
If the error persists, try restarting your PC to make sure you don't have any
stale CMD, PowerShell or IDE sessions and rerun the go version
command.
The solve the error "'go' is not recognized as an internal or external command, operable program or batch file", make sure:
go
executable in your system's PATH environment
variable.