개요

Mac에서 GO 설치하는 방법을 정리해둔다.

GO 바이너리 설치

https://golang.org/dl/에서 다운로드 후 설치

환경변수 설정

~/.bashrc나 ~/.bash_profile에 아래 환경변수 설정

export PATH=$PATH:/usr/local/go/bin

이후 source ~/.bashrc 또는 source ~/.bash_profile 수행

설치 확인

터미널을 새로 열어 go입력해봤을때 정상적으로 실행이 되면 정상이다.

lks21c@kakaos-MacBook-Pro-4:~ ()$ go
Go is a tool for managing Go source code.

Usage:

    go <command> [arguments]

The commands are:

    bug         start a bug report
    build       compile packages and dependencies
    clean       remove object files and cached files
    doc         show documentation for package or symbol
    env         print Go environment information
    fix         update packages to use new APIs
    fmt         gofmt (reformat) package sources
    generate    generate Go files by processing source
    get         download and install packages and dependencies
    install     compile and install packages and dependencies
    list        list packages or modules
    mod         module maintenance
    run         compile and run Go program
    test        test packages
    tool        run specified go tool
    version     print Go version
    vet         report likely mistakes in packages

Use "go help <command>" for more information about a command.

Additional help topics:

    buildmode   build modes
    c           calling between Go and C
    cache       build and test caching
    environment environment variables
    filetype    file types
    go.mod      the go.mod file
    gopath      GOPATH environment variable
    gopath-get  legacy GOPATH go get
    goproxy     module proxy protocol
    importpath  import path syntax
    modules     modules, module versions, and more
    module-get  module-aware go get
    packages    package lists and patterns
    testflag    testing flags
    testfunc    testing functions

Use "go help <topic>" for more information about that topic.