Go installation and configuration in macOS environment
1. Download the installation package
Try to choose the official website to download, and choose the required package according to your own system version and number of digits
2. Configure environment variables
After the installation is complete, we need to manually configure the environment variables
Open the terminal and enter cd ~ to enter the user's home directory;
Enter the ls -all command to see if .bash_profile exists;
vim .bash_profile
Open the file with if it exists ;
Enter i to enter vim editing mode;
Enter the following code:
export GOPATH=/Users/lcore/dev/code/go
export GOBIN=$GOPATH/binexport
PATH=$PATH:$GOBIN
Save and exit with source ~/.bash_profile
the command to make the configuration take effect
Enter in the terminal go version
, if the following figure appears, the installation is successful