Use Brew to install and use Golang under Mac

Source: Internet
Author: User

Suddenly want to go to the pit, and then try to on the company's new Mac on the toss

installation
by executing a command

Brew Search Go

See available The latest version is 1.7, it's him.

Brew install [email protected]

installed, follow the online tutorial directly in the terminal to perform go, the results prompt command does not exist Orz. All right, add your own name.
Open a. Bash_profile and add:

Alias go= '/usr/local/cellar/go\@1.7/1.7.6/bin/go '

Executes the source. Bash_profile, and then executes go. All normal ~

Follow the tutorials, and then continue to set several environment variables in. Bash_profile:

Export goroot=/usr/local/opt/go\@1.7/bin/
Export gopath=~/code/golang/# This is my project path
Export gobin= $GOPATH/bin
Export path=GOBIN

Then execute go ENV

Goarch= "AMD64"
Gobin= "/users/atai/code/golang//bin"
Goexe= ""
Gohostarch= "AMD64"
Gohostos= "Darwin"
Goos= "Darwin"
Gopath= "/users/atai/code/golang/"
Gorace= ""
goroot= "/usr/local/opt/[email Protected]/bin"
Gotooldir= "/usr/local/opt/[email protected]/bin/pkg/tool/darwin_amd64"
Cc= "Clang"
Gogccflags= "-fpic-m64-pthread-fno-caret-diagnostics-qunused-arguments-fmessage-length=0-fdebug-prefix-map=/var /folders/37/4py2jv5d4pvcf61kz4tf7q800000gn/t/go-build735656329=/tmp/go-build-gno-record-gcc-switches- Fno-common "
cxx= "clang++"
cgo_enabled= "1"

Perfect (old??????) Old

IDE
Jetbrain IDE is accustomed to, so go directly to the official website to download and install the Gogland. Rare free (??????)??

Open Gogland wrote Hello World ready to run, the results prompted to set the next goroot in the IDE. OK, after you open the pop-up window of the selection directory, press command+shift+g, enter/usr/local/cellar/[email Protected]/1.7.6,open, and then the 1.7 version of Go will appear.

Well, the rest is the start.

Use Brew to install and use Golang under Mac

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.