Install the Go language and configure environment variables under MAC OSX 10.9.1

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

Read a lot of people on the Internet on the MAC configuration go article, the feeling is not clear, since the record of their installation configuration of the whole process, so as to avoid detours.


Go Official homepage English version, not used to see English, please hit the Chinese version. Under document there is the official install Go guide, point download Go will appear each version, mac10.9 Select both of these can be, just. tar.gz is a compressed file installation package, want to save the download pkg, a fool next on the line.

PKG is installed to/usr/local/go by default


The installation section is done, and the next step is to configure the environment variables under Mac. This is the most critical.

Open the terminal (Terminal) and click on the code:

CD ~ #进入当前用户下的根目录

Ls-a #-A to display hidden files, you may see a. bash_profile file if you do not create it yourself (not on my computer)

Vim. Bash_profile #创建很简单

After entering Vim, press A to edit and enter the code:

Export Goroot=/usr/local/go

Export Path=/usr/local/go/bin: $PATH

Export gopath= where you normally place the Go code

Explain what it means:

Goroot is the PKG package default installation to the place, from the official website can also be seen, the default is installed to/usr/local/go

Path is important, the system comes with the source code to run must have this path, the default installation path when the/usr/local/go/bin

Gopath can be a favorite place for users to put their own written go program


At this point, the. bash_profile file is written, press ESC, typing: WQ, enter, done.

After returning to the terminal, enter source. bash_profile Make edits effective

Verify that the path configuration is successful: Echo $GOROOT, you can see the/usr/local/go.

If you don't see it, restart Ternimal.

The environment variable configuration is complete.


Finish


The next article explains how to configure the Go environment in sublime Text3

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.