Build the Go Language development environment under MAC

Source: Internet
Author: User
Tags install go

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.