Download Go distribution

Download Go Click here to visit the downloads page

Official binary distributions are available for the FreeBSD (release 8-STABLE and above), Linux, Mac OS X (10.8 and above), and Windows operating systems and the 32-bit ( 386) and 64-bit ( amd64) x86 processor architectures.

System requirements

Go binary distributions are available for these supported operating systems and architectures. Please ensure your system meets these requirements before proceeding. If your OS or architecture is not on the list, you may be able to install from source or use gccgo instead.

Operating system Architectures Notes

FreeBSD 8-STABLE or later amd64 Debian GNU/kFreeBSD not supported
Linux 2.6.23 or later with glibc amd64, 386, arm CentOS/RHEL 5.x not supported
Mac OS X 10.7 or later amd64 use the clang or gcc that comes with Xcode for cgo support
Windows XP or later amd64, 386 use MinGW gcc . No need for cygwin or msys.
Install the Go tools

If you are upgrading from an older version of Go you must first remove the existing version.

Linux, Mac OS X, and FreeBSD tarballs

Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:

        tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
      

Choose the archive file appropriate for your installation. For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux, the archive you want is called go1.2.1.linux-amd64.tar.gz.

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

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

Windows

The Go project provides two installation options for Windows users (besides installing from source):

Test your installation

Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.

Create a directory to contain your workspace, $HOME/work C:\work for example, and set the GOPATH environment variable to point to that location.

        $ export GOPATH=$HOME/work
      

You should put the above command in your shell startup script ( $HOME/.profile for example).

Next, make the directories src/github.com/user/hello inside your workspace (if you use GitHub, substitute your user name for user), and inside the hello directory create a file named hello.go with the following contents:

        package main  

        import "fmt"  

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

Then compile it with the go tool:

        $ go install github.com/user/hello
      

The command above will put an executable command named hello (or hello.exe) inside the bin directory of your workspace. Execute the command to see the greeting:

        $ $GOPATH/bin/hello
        hello, world
      

If you see the "hello, world" message then your Go installation is working.

Before rushing off to write Go code please read the How to Write Go Code document, which describes some essential concepts about using the Go tools.

Uninstalling Go

To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go under Linux, Mac OS X, and FreeBSD or c:\Go under Windows.

You should also remove the Go bin directory from your PATH environment variable. Under Linux and FreeBSD you should edit /etc/profile or $HOME/.profile. If you installed Go with the Mac OS X package then you should remove the /etc/paths.d/go file. Windows users should read the section about setting environment variables under Windows.

Getting Help
References

All the documentation in this page is taken from golang.org