Download Go Click here to visit the downloads page
Click the link above to visit the Go project's downloads page and select the binary distribution that matches your operating system and processor architecture.
Official binary distributions are available for the FreeBSD, Linux, Mac OS X
(Snow Leopard, Lion, and Mountain Lion), NetBSD, and Windows operating systems
and the 32-bit (386
) and 64-bit (amd64
) x86 processor
architectures.
If a binary distribution is not available for your combination of operating system and architecture you may want to try installing from source or installing gccgo instead of gc.
The gc
compiler supports the following operating systems and
architectures. Please ensure your system meets these requirements before
proceeding. If your OS or architecture is not on the list, it's possible that
gccgo
might support your setup; see
Setting up and using gccgo for details.
Operating system | Architectures | Notes |
---|---|---|
FreeBSD 7 or later | amd64, 386, arm | Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later |
Linux 2.6.23 or later with glibc | amd64, 386, arm | CentOS/RHEL 5.x not supported; no binary distribution for ARM yet |
Mac OS X 10.6/10.7 | amd64, 386 | use the gcc† that comes with Xcode‡ |
Windows 2000 or later | amd64, 386 | use mingw gcc†; cygwin or msys is not needed |
NetBSD 6 or later | amd64, 386 |
†gcc
is required only if you plan to use
cgo.
‡You only need to install the command line tools for
Xcode. If you have already
installed Xcode 4.3+, you can install it from the Components tab of the
Downloads preferences panel.
The Go binary distributions assume they will be installed in
/usr/local/go
(or c:\Go
under Windows),
but it is possible to install them in a different
location. If you do this, you will need to set the GOROOT
environment variable to that directory when using the Go tools.
For example, if you installed Go to your home directory you should add the
following commands to $HOME/.profile
:
export GOROOT=$HOME/go export PATH=$PATH:$GOROOT/bin
Windows users should read the section about setting environment variables under Windows.
If you are upgrading from an older version of Go you must
first remove the existing version from /usr/local/go
:
rm -r /usr/local/go
Extract the archive
into /usr/local
, creating a Go tree in /usr/local/go
.
For example:
tar -C /usr/local -xzf go1.0.3.linux-amd64.tar.gz
The name of the archive may differ, depending on the version of Go you are installing and your system's operating system and processor architecture.
(Typically these commands must be run as root or through sudo
.)
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
Open the package file
and follow the prompts to install the Go tools.
The package installs the Go distribution to /usr/local/go
.
The package should put the /usr/local/go/bin
directory in your
PATH
environment variable. You may need to restart any open
Terminal sessions for the change to take effect.
The Go project provides two installation options for Windows users (besides installing from source): a zip archive that requires you to set some environment variables and an experimental MSI installer that configures your installation automatically.
Extract the zip file
to the directory of your choice (we suggest c:\Go
).
If you chose a directory other than c:\Go
, you must set
the GOROOT
environment variable to your chosen path.
Add the bin
subdirectory of your Go root (for example, c:\Go\bin
) to to your PATH
environment variable.
Open the MSI file
and follow the prompts to install the Go tools.
By default, the installer puts the Go distribution in c:\Go
.
The installer should put the c:\Go\bin
directory in your
PATH
environment variable. You may need to restart any open
command prompts for the change to take effect.
Under Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.
Check that Go is installed correctly by building a simple program, as follows.
Create a file named hello.go
and put the following program in it:
package main import "fmt" func main() { fmt.Printf("hello, world\n") }
Then run it with the go
tool:
$ go run hello.go hello, world
If you see the "hello, world" message then your Go installation is working.
The document How to Write Go Code explains how to set up a work environment in which to build and test Go code.
Start by taking A Tour of Go.
Build a web application by following the Wiki Tutorial.
Read Effective Go to learn about writing idiomatic Go code.
For the full story, consult Go's extensive documentation.
Subscribe to the golang-announce mailing list to be notified when a new stable version of Go is released.
For real-time help, there may be users or developers on
#go-nuts
on the Freenode IRC server.
The official mailing list for discussion of the Go language is Go Nuts.
Bugs should be reported using the Go issue tracker.