How to install go language environment on mac computer

青灯夜游
Release: 2021-03-15 16:17:21
Original
7527 people have browsed it

How to install the go language environment on a Mac computer: 1. Open the terminal and enter the "brew install go" or "brew install golang" command. 2. Download the installation package from the official website and click on the pkg file to install.

How to install go language environment on mac computer

The operating environment of this tutorial: macOS Big Sur system, GO 1.11.2, MacBook Pro computer.

MAC There are two ways to install go

One, install through brew

Enter brew install in the terminal go or brew install golang. Before installation, you can use brew info go to view version information

##~ brew info go

go: stable 1.10.1 (bottled), HEADOpen source programming language to build simple/reliable/efficient software

https://golang.orgNot installed....~ brew info golang

go: stable 1.10.1 (bottled), HEADOpen source programming language to build simple/reliable/efficient software

https://golang.orgNot installed means you have not installed go

2. Download the installation package

Address: https://golang.org/dl/

How to install go language environment on mac computer

The location of the installation package is generally users/local/go

# by default ##Configure environment variables

1. Open the terminal and enter cd ~ to enter the user’s home directory;

2. Enter the ls -all command to check whether .bash_profile exists;

3. There is a way to open the file using vim .bash_profile;

4. Enter i to enter vim editing mode;

5. Enter the following code,

GOPATH: the root directory for daily development . GOBIN: It is the bin directory under GOPATH.

export GOPATH=/Users/lcore/dev/code/go

export GOBIN=$GOPATH/binexport

PATH=$PATH:$GOBIN

How to install go language environment on mac computerEnter vim .bash_profile to check whether the save is successful

Enter go env to check the configuration results, mine is as follows

How to install go language environment on mac computer The next step is to install beego

In the terminal, enter go get github.com/astaxie/beego

Install the bee tool go get github.com/beego/bee

After the installation is completed, Enter bee new project name in the terminal and press Enter.

Then start programming, Saonian.

Recommended learning:

Golang tutorial

The above is the detailed content of How to install go language environment on mac computer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!