One. Download and install Go
To download the go installation package in the wall:
Http://www.golangtc.com/download
Click Install package and install
Two. Configuration
1. View the Environment
Go version
2. after installing the SDK, the next step is to configure the environment variables, open the terminal input CD ~ Enter the user home directory, and then enter the Ls-all command to see if there are any. bash_profile
file that exists both using VIM. Bash_profile to open and edit the file. According to their actual situation, the contents are as follows:
Export gopath=/users/apple/documents/dev/goexport GOBIN= $GOPATH/binexport PATH= $PATH: $GOBIN
Go env
Goarch="386"GOBIN="/users/apple/documents/dev/go/bin"Gochar="8"Goexe=""Gohostarch="386"Gohostos="Darwin"GOOS="Darwin"Gopath="/users/apple/documents/dev/go"Gorace=""Goroot="/usr/local/go"Gotooldir="/usr/local/go/pkg/tool/darwin_386"CC="GCC"Gogccflags="-fpic-m32-pthread-fmessage-length=0-fno-common"CXX="g++"cgo_enabled="1"
Cd/users/apple/documents/dev/go
Vim Main.go
Package Mainimport ( "fmt") Func main () { fmt. Println ("Hello go");}
Compile it with Go build xx (project name)
Ademacbook-pro:go apple$./Mainhello Go
Build the Go Language development environment under MAC