In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to install go in mac", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to install go in mac" this article.
Installation mode
Brew install go
Download the corresponding installation package on the official website and install it directly
Note:
In the first way, the go executable file is under / usr/local/bin. In fact, the go in this directory is a soft connection.
➜bin ll / usr/local/bin | grep golrwxr-xr-x 1 ljh admin 26 9 28 10:46 go->.. / Cellar/go/1.15.2/bin/golrwxr-xr-x 1 ljh admin 29 9 28 10:46 godoc->.. / Cellar/go/1.15.2/bin/godoclrwxr-xr-x 1 ljh admin 29 9 28 10:46 gofmt->.. / Cellar/go/1.15.2/bin/gofmt
We found that this is actually linked to the go installation directory of brew install.
The second way to install is that the executable file of go is under / usr/local/go/bin, which is the default installation directory of go pkg package.
But no matter how you install it, you have to configure GOPATH/GOBIN/PATH, as follows, these three variables will be explained later
# goexport GOPATH=/Users/ljh/goexport GOBIN=$GOPATH/binexport PATH=$PATH:$GOBIN
At this point, run go env
GO111MODULE= "" GOARCH= "amd64" GOBIN= "/ Users/ljh/go/bin" GOCACHE= "/ Users/ljh/Library/Caches/go-build" GOENV= "/ Users/ljh/Library/Application Support/go/env" GOEXE= "" GOFLAGS= "" GOHOSTARCH= "amd64" GOHOSTOS= "darwin" GOINSECURE= "" GOMODCACHE= "/ Users/ljh/go/pkg/mod" GONOPROXY= "GONOSUMDB=" GOOS= "darwin" GOPATH= "/ Users/ljh/go" GOPRIVATE= "" GOPROXY= "https://proxy.golang.org, Direct "GOROOT=" / usr/local/Cellar/go/1.15.2/libexec "GOSUMDB=" sum.golang.org "GOTMPDIR="GOTOOLDIR=" / usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64 "GCCGO=" gccgo "AR=" ar "CC=" clang "CXX=" clang++ "CGO_ENABLED=" 1 "GOMOD="CGO_CFLAGS="-g-O2 "CGO_CPPFLAGS="CGO_CXXFLAGS="-g-O2 "CGO_FFLAGS="-g-O2 "CGO_LDFLAGS=" -GO2 "PKG_CONFIG=" pkg-config "GOGCCFLAGS="-fPIC-M64-pthread-fno-caret-diagnostics-Qunused-arguments-fmessage-length=0-fdebug-prefix-map=/var/folders/1l/mwvs7rf563x72kqcv7l6rb840000gn/T/go-build705548469=/tmp/go-build-gno-record-gcc-switches-fno-common "
It is found that there is another GOROOT. Let's explain it.
Nouns explain GOROOTgo language installation directory GOPATH project workspaceGOBIN executable file directory, such as go install will generate executable files directly into the bin directory
GOPATH will also contain three directory nouns | explain-src | Source file pkg | compiled library files, mainly * .a files, for example, go install puts compiled ordinary packages into the pkg directory bin | executable directory, such as go install will generate executable files directly into the bin directory
Generally speaking, you have to add the go executable directory (${GOBIN}) to the PATH so that the GO command and the GO application we write can be called globally
So we have completed the installation of golang
The above is all the contents of the article "how to install go in mac". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.