blob: 4d7225c5f1684285c440ed3eaee75ef91e60267d [file] [log] [blame] [view]
Russ Cox270a22d2023-12-05 11:15:03 -05001---
2title: InstallFromSource
3---
4
5## Introduction
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11006
Sean Liao3c9c9e12022-01-22 17:27:16 +01007This is a companion to https://go.dev/doc/install/source providing additional instructions for various operating systems.
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11008
9## Install C tools
10
11On OS X, a C compiler is bundled in the command line tools for
12[Xcode](http://developer.apple.com/Xcode/),
13and you don't need to install the whole Xcode to compile Go.
14If you have already installed Xcode 4.3+, you can install command
15line tools from the Components tab of the Downloads preferences panel.
16In more recent versions of Xcode, you can use ` xcode-select --install `
17command to install the command line tools without opening Xcode.
18To verify you have a working compiler, just invoke ` gcc `
19in a freshly created Terminal window, unless you see the
20` "gcc: command not found" ` error, you are ready to go.
21
22On Ubuntu/Debian, use ` sudo apt-get install gcc libc6-dev `.
23If you want to build 32-bit binaries on a 64-bit system you'll also need the ` libc6-dev-i386 ` package.
24
25On RedHat/Centos 6, use ` sudo yum install gcc glibc-devel `.
26If you want to build 32-bit binaries on a 64-bit system you'll need both
27` glibc-devel.i386 ` and ` glibc-devel.x86_64 ` packages.
28
29On Windows, install ` gcc ` with
Ian Lance Taylorc9bf0372023-03-27 10:45:21 -070030[TDM-GCC](http://tdm-gcc.tdragon.net/). or try [TDM-GCC Sourceforge link](https://sourceforge.net/projects/tdm-gcc/).
Gianluca Casatib5427682015-07-21 22:24:21 +020031(Make sure you add its ` bin ` subdirectory to your ` PATH `.) Go does not support the Cygwin toolchain.
Russ Cox270a22d2023-12-05 11:15:03 -050032