Go Language Environment Installation

Go language supports the following systems:

  • Linux
  • FreeBSD
  • Mac OS X (also known as Darwin)
  • Windows

The download address for the installation package is:https://go.dev/dl/。

If it cannot be opened, you can use this address:https://golang.google.cn/dl/。

The package names corresponding to each system:

Installer package filename Supported Systems Processor Architecture System version requirements Description
go1.26.3.windows-amd64.msi Microsoft Windows x86-64 (Intel 64-bit) Windows 10 or later Windows 64-bit system graphical installer
go1.26.3.darwin-arm64.pkg Apple macOS ARM64 (Apple Silicon 64-bit) macOS 12 or later Installer package for M-series chip Macs (including your Mac mini 4)
go1.26.3.darwin-amd64.pkg Apple macOS x86-64 (Intel 64-bit) macOS 12 or later For older Macs with Intel processors
go1.26.3.linux-amd64.tar.gz Linux x86-64 (Intel 64-bit) Linux 3.2 or later Compressed archive for most 64-bit Linux systems
go1.26.3.src.tar.gz Any system Source code - Go language source code package, requires compiling yourself

UNIX/Linux/Mac OS X, and FreeBSD Installation

The following describes how to install from source on UNIX/Linux/Mac OS X, and FreeBSD systems:

1. Download the binary package: go1.4.linux-amd64.tar.gz.

2. Extract the downloaded binary package to the /usr/local directory.

tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz

3. Add the /usr/local/go/bin directory to the PATH environment variable:

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

The above only temporarily adds PATH; it will be gone after closing the terminal and logging in next time.

We can edit ~/.bash_profile or /etc/profile, and add the following command to the end of the file, so it takes effect permanently:

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

After adding, you need to execute:

source ~/.bash_profile
或
source /etc/profile

Note:On MAC systems you can use.pkgDouble-click the installation package ending with to complete the installation; the installation directory is at/usr/local/go/Download.


Installation on Windows systems

On Windows, you can install using the package with the .msi suffix (you can find this file in the download list, such as go1.4.2.windows-amd64.msi).

By default.msiFiles will be installed in thec:\Godirectory. You canc:\Go\binAdd the directory toPathIn the environment variables. After adding it, you need to restart the command window for it to take effect.

Installation test

Create working directoryC:\>Go_WorkSpace。

The test.go file code:

package main

import "fmt"

func main() {
   fmt.Println("Hello, World!")
}

Using the go command to execute the above code outputs the following result:

C:\Go_WorkSpace>go run test.go

Hello, World!
other extensions