I'd like to use the Pis with Raspbian to run Go code. For this, I like to write an easy and fast setup guide from the point you erase the SD card. During the development, I installed Go on the Pis with this guide. It has some deficiencies but works fine. My only problem is, that we have to install mercurial just for cloning the sources: hg clone -u default https://code.google.com/p/go $HOME/go The installation of mercurial on Pi is really slow. I'd like to ask how to work it around (It's not a problem if I don't build it from source.)

4 Answers 4


There's already a go compiler in, e.g., raspbian, which you can find with apt-cache search golang. This looks to be version 1.0.2.

The site you linked has pre-compiled tarballs of 1.3.3 available for the pi. You just need to download the appropriate one -- it is clearly indicated.

Put the tarball in /usr/local and:

tar -xzf go.1.3.3.linux-arm~multiarch-armv6-1.tar.gz

This will create a go directory; the top level README refers to the contents as the go source, but if you look in the bin directory, you'll see the precompiled go executable there. To make this generally useful you'll have to get that into $PATH. Add a file to /etc/profile.d called go.sh with one line:

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

If there's already a go installed, this will now supersede that. I'm not a go user so I don't know if much more is necessary, but if you look in the doc directory there's lots of stuff there, including an install.html file.

  • another +1 for sudo apt-get install golang
    – JonAlb
    Jan 21, 2016 at 23:39

As of Go 1.6 (February 2016), an official ARMv6 package is available for download. So, if your Raspberry Pi has ARMv6 or v7 (see cat /proc/cpuinfo | grep ARM), then just do something like:

wget https://storage.googleapis.com/golang/go1.6.2.linux-armv6l.tar.gz 
sudo tar -xzf go1.6.2.linux-armv6l.tar.gz -C /usr/local
sudo chgrp -R staff /usr/local/go
export GOROOT=/usr/local/go
export PATH="$PATH:$GOROOT/bin"

The above is fast, and less cumbersome than building 1.5+ from source:

To build Go 1.x, for x ≥ 5, it will be necessary to have Go 1.4 (or newer) installed already, in $GOROOT_BOOTSTRAP.


Should be as simple as

sudo apt-get install mercurial

there are other mercurial packages that can be found via

sudo apt-cache search mercurial

Here is a super easy way to install the very latest Golang version for your Raspberry PI.

Find the lastest release version tag, download the pkg, and install it

export GOPKG="$(curl -s https://api.github.com/repos/golang/go/git/matching-refs/tags/go | grep ref | grep -v url | grep -v beta | tail -1 | awk -F\/ {' print $3 '} | sed 's/",//')"
wget https://golang.org/dl/$GOPKG.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf $GOPKG.linux-armv6l.tar.gz
rm $GOPKG.linux-armv6l.tar.gz

Setup the shell

# for zsh
echo PATH=$PATH:/usr/local/go/bin >> $HOME/.zshrc
echo GOPATH=$HOME/golang >> $HOME/.zshrc
source $HOME/.zshrc

I wrote this up in a blog post on my website for easy reference: Golang on Raspberry PI (Easiest)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.