打开文件编辑器:

进入终端,输入open -e .bash_profile或者open -t ~/.bash_profile  打开profile文件


填写配置的环境变量:

#示例代码

export PATH=$PATH:/usr/local/bin
export ANDROID_HOME=/Users/lucky/Desktop/Auto/tools/android-sdk-macosx
PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
echo $ANDROID_HOME
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$JAVA_HOME/bin:$PATH:/Users/lucky/Desktop/Auto/tools/apache-tomcat-9.0.8/bin
export ANT_HOME=/Users/lucky/Desktop/Auto/tools/apache-ant-1.10.3
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
# Add Cmake Root to Path
export CMAKE_ROOT=/Applications/CMake.app/Contents/bin
export PATH=$CMAKE_ROOT:$PATH
export PATH="/usr/local/opt/freetds@0.91/bin:$PATH"
PATH="/usr/local/mysql/bin:${PATH}"
export PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=yes
export VERSIONER_PYTHON_PREFER_32_BIT=no


# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

 

保存配置:

 

编辑完成后保存profile文件后保存,返回终端,输入​​source .bash_profile​​使环境变量生效

 

 1.作者:Syw

2.本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

3.如果文中有什么错误,欢迎指出。以免更多的人被误导。