【Mac】-NO.161.Mac.1 -【MacOS 中环境变量设置 zsh: command not found: xxx】

时间:2023-12-05 13:36:50

Style:Mac

Series:Java

Since:2018-09-10

End:2018-09-10

Total Hours:1

Degree Of Diffculty:5

Degree Of Mastery:5

Practical Level:5

Desired Goal:5

Archieve Goal:3

Gerneral Evaluation:3

Writer:kingdelee

Related Links:

http://www.cnblogs.com/kingdelee/

1.当安装了zsh与linux不同

单纯的使用这个方法 vim ~/.bash_profile,

export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
export JAVA_10_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home export GRADLE_HOME=$/Users/kingdelee/Library/gradle/gradle-4.10.2
export GRADLE_USER_HOME=/Users/kingdelee/workstation/gradle/.gradle
export MAVEN_HOME=/Users/kingdelee/Library/Maven/apache-maven-3.5.4 alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
alias jdk10="export JAVA_HOME=$JAVA_10_HOME"
alias jdk11="export JAVA_HOME=$JAVA_11_HOME" export JAVA_HOME=$JAVA_11_HOME PATH="${PATH}:${JAVA_HOME}:${GRADLE_HOME}/bin:${MAVEN_HOME}/bin"
export PATH

  

再执行source ~/.bash_profile ,新建标签的时候,新标签仍旧无法生效

必须要 open ~/.zshrc,然后再文档末尾追加

source ~/.bash_profile

这样执行source ~/.zshrc,新开标签也可以了。

然并卵,还是得在 ~/.zshrc 后面追加 具体的环境变量设置,即把/.bash_profile的那些拷贝到zshrc里边

  

vim ~/.zshrc

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/.bash_profile
source /etc/profile #export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
#export JAVA_10_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
#export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home #export GRADLE_HOME=$/Users/kingdelee/Library/gradle/gradle-4.10.2
#export GRADLE_USER_HOME=/Users/kingdelee/workstation/gradle/.gradle
#export MAVEN_HOME=/Users/kingdelee/soft/maven/maven-3.6.0 #alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
#alias jdk10="export JAVA_HOME=$JAVA_10_HOME"
#alias jdk11="export JAVA_HOME=$JAVA_11_HOME" #alias mysql="/usr/local/mysql/bin/mysql"
#alias mysqladmin="/usr/local/mysql/bin/mysqladmin" #export JAVA_HOME=$JAVA_11_HOME PATH="${PATH}:${JAVA_HOME}:${GRADLE_HOME}/bin:${MAVEN_HOME}/bin"
export PATH