How to install go language on mac
How to install go language under mac: first download the corresponding version of the installation package from the go language official website; then double-click the installation package to start the installation. The installation package is installed in the [/usr/local] directory by default; finally, in the terminal Run the [go version] command to check whether the installation is successful.
The operating environment of this article: mac os X system, GO 1.11.2, macbook pro computer.
(Learning video sharing: Programming video)
Specific method:
First download the installation package of the corresponding version from the Go language official website (https: //golang.google.cn/dl/)
The Go language development package for Mac OS is in .pkg format. Double-click the installation package we downloaded to start the installation.
# Under Mac OS, it is a fool-proof installation. Just click "Continue" all the way and I won't go into details.
The installation package will be installed in the /usr/local directory by default, as shown below.
#After the installation is complete, run go version in the terminal. If information similar to the following is displayed, the installation is successful.
go version go1.13.4 darwin/amd64
Set the GOPATH environment variable
Before we start writing go project code, we need to configure the environment variables first. Edit ~/.bash_profile (just run vi ~/.bash_profile in the terminal) to add the following line of code (if you can’t find .bash_profile, just create one yourself)
export GOPATH=$HOME/go
Save and exit your editor. Then run the following command in the terminal
source ~/.bash_profile
Tip: $HOME is the user home directory under each computer. Each computer may be different. You can run echo $HOME in the terminal to get
GOROOT means that the installation directory of the Go development package is /usr/local/go by default. If not, it can be set in the bash_profile file.
export GOROOT=/usr/local/go
Then save and exit the editor, and run the source ~/.bash_profile command.
Related recommendations: golang tutorial
The above is the detailed content of How to install go language on mac. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Queue threading problem in Go crawler Colly explores the problem of using the Colly crawler library in Go language, developers often encounter problems with threads and request queues. �...

The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

The difference between string printing in Go language: The difference in the effect of using Println and string() functions is in Go...

Go pointer syntax and addressing problems in the use of viper library When programming in Go language, it is crucial to understand the syntax and usage of pointers, especially in...

Regarding the problem of custom structure tags in Goland When using Goland for Go language development, you often encounter some configuration problems. One of them is...

The correct way to implement efficient key-value pair storage in Go language How to achieve the best performance when developing key-value pair memory similar to Redis in Go language...

Performance optimization strategy for Go language massive URL access This article proposes a performance optimization solution for the problem of using Go language to process massive URL access. Existing programs from CSV...
