The program 'go' is currently not installed. You can install it by typing:sudo apt install golang-go

Posted on Sun 03 June 2018 in Software Engineering

I landed accidently on a question on AskBuntu forum where the OP shares the error message he got when he tried to install Go language on Ubuntu. Below are the steps I followed to reproduce the error message. They are the same ones followed by the owner of the post who, in turn, took them from the Go official documentation itself. By the end, I show how to fix the issue.

I went to and downloaded the binary which corresponds to the last version by the time of writing this post, which is go1.10.2. Because I have a 64 bits CPU, I clicked to download the file go1.10.2.linux-amd64.tar.gz

I then copied go1.10.2.linux-amd64.tar.gz file to /usr/local:

sudo cp go1.10.2.linux-amd64.tar.gz /usr/local

Time to uncompress the file:

sudo tar -xzvf go1.10.2.linux-amd64.tar.gz

The command will create a go folder following this tree: /usr/local/go.

I added the value /usr/local/go/bin to the already existing environment variable PATH in ~/.profile as explained in the official documentation:

export PATH=$PATH:/usr/local/go/bin

I then tried to run the file $HOME/go/src/hello/hello.go as explained in the documentation:

package main
import "fmt"

func main() {
    fmt.Printf("hello, world\n")

And finally, I ended up by facing this error message whenever I invoked go build or any other go commands from the shell:

The program 'go' is currently not installed. You can install it by typing:sudo apt-get install golang-go

Of course, one one way to circumvent this issue is to do what the error message suggests: running sudo apt-get golang-go. But then, you will not get benefits from the latest Go version (I tried that in a virtual machine and I got the version 1.6 instead) and even if you find some repository to run the last Go version, keep in mind such packages are not created or maintained by the Go propject. It is always better to install from source.

echo "export PATH=$PATH:/usr/local/go/bin" >> .bashrc

For this to take effect, we must source this file using this command:

source /etc/bash.bashrc

This solves the problem.

Note that in general it is a bad practice to try edit /etc/profile (corresponding to ~/.profile) because it is the configuration file for the base-files packages. But /etc/bash.bashrc (corresponding to ~/.bashrc)is more suitable for similar scenarios to this one because you can run programs from the shell.