Using GVM (Go Version Manager) to Install Golang

I’m starting a project in Go. The first step was obviously to install Go, but after a half hour wrestling with an old and broken installation and a out-of-date PPA, I got fed up.

Then I found gvm. If you’re familiar with rvm for Ruby, I think you’re going to like gvm.

Setup on Ubuntu is pretty simple:

$ bash < <(curl -s

Then you’ll need to restart your terminal.

Since the install script seems to assume you’re using bash, if you’re using a shell other than bash, you’ll need to add this to your config file (e.g .zshrc, etc):

[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"

In my case, I wanted the latest version of Go (1.2 as of this writing), so I ran:

$ gvm install go1.2
$ gvm use go1.2 --default

The --default flag sets that particular version of go as the default when you open a new terminal session.

It was fun to see that gvm was written by the devs at MoovWeb. When I visited them a few days ago I was interested that they were using Go for their backend – clearly they’re pretty invested!