The setup of Go language environment under Mac

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Go Language Runtime Package installation

Download Address:


I downloaded: go1.0.3 Mac OS X (x86 64-bit) signed PKG installer


Install directly when the download is complete. The run package is automatically installed in/usr/local/go so that the go command can be run at the command terminal.

When you enter go at the command line, you will see the following message:

Cybercarematomacbook-pro:ios cybercare$ Go
Go is a tool for managing go source code.


Go command [arguments]

The commands are:

Build compile packages and dependencies
Clean Remove object files
Doc run Godoc on package sources
ENV Print Go Environment information
Fix run Go tool fix on packages
FMT run GOFMT on package sources
Get download and install packages and dependencies
Install compile and install packages and dependencies
List List Packages
Run compile and run Go program
Test test Packages
Tool run specified Go tool
Version Print Go version
Vet Run Go tool vet on packages

Use the "Go help [command]" For more information about a command.

Additional Help Topics:

Gopath gopath environment variable
Packages description of the package lists
Remote Remote import path syntax
Testflag Description of testing flags
TestFunc Description of testing functions

Use ' Go help [topic] ' For more information on that topic.

In/usr/local/go/misc, you can see that there are many editor versions under which you can automatically configure different editors to develop the go language.

Methods to check whether the installation was successful

Create a new file Hello.go with the following contents:

Package Main

Import "FMT"

Func Main () {
Fmt. Printf ("Hello, world\n")

Executing go run hello.go on the command line should receive the following information:

Go Run hello.go
Hello, world

This means that go is installed properly.

If there is a problem with your environment variable and an error:
Type Go env
Take a look at the environment variables for Go

Settings for development tools

There are many development tools to choose from, and here I choose Liteide,liteide is an integrated development environment (IDE) specifically developed for the go language.

Download Address: Https://

I downloaded: liteidex16.macosx-10.6-webkit.dmg

Project home: Http://
Project Source: Http://
Discussion group: Http://
Download Link:
Update Record: Http://

When installing, remember to drag the app from the DMG file to the app, and the configuration file cannot be modified in DMG.

When opening liteide, take a look at the tips of the package browse here, if it is the following way:

The typical reason is that the Goroot global variable is not configured. We need to modify the global settings, the default Goroot address is $HOME/go

We are installed here in/usr/local/go, obviously not, need to modify, modify and Refresh package Browse.

Refresh Package browsing. Until you see a similar way:

Once configured, performing with the default code will result in normal results.



Install the Go language first experience on your 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: 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.