1.0 check whether bash_profile exists
cd ~/.bash_profile
2.0 create a bash_profile Mac environment configuration file if it does not exist
touch ~/.bash_profile
3.0 open bash_profile
open -t ~/.bash_profile
4.0 Add the go environment variable: (Save the directory for your project after the equal sign)
GOPATH=website/apple/apps
5.0 warning: If the command line LS command is invalid because bash_profile is created, the Go language cannot be installed.
5.1 open bash_profile and add environment variables.
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
5.2 restart the command line tool to delete bash_profile close command line delete go file reinstall under (/usr/local /)
rm ~/.bash_profile
5.3 you can reconfigure the preceding configuration method.
6. After configuring the project directory, add three folders.
The $ gopath directory Convention has three subdirectories:
- SRC stores Source Code (for example,. Go. C. H. S)
- PKG files generated after compilation (for example,.)
- The executable file generated after Bin compilation (for convenience, you can add this directory to the $ PATH variable. If there are multiple gopath, use
${GOPATH//://bin:}/bin
Add all bin Directories)