mac環境變量不生效問題


1.在 ~/.zshrc 中添加

source ~/.bash_profile 

參考:https://blog.csdn.net/qq_18505715/article/details/83276208

 

2.比如mac的git命令補全不生效,可以參考如下文章添加

https://blog.csdn.net/WinWill2012/article/details/71774461

source ~/.git-completion.bash

 

3.調整mac終端顏色和全路徑顯示

export PS1="%n@%m %0~ $ "

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'

如果安裝的oh my zsh,那么修改全路徑顯示的方式是

vim ~/.oh-my-zsh/themes/robbyrussell.zsh-theme

修改成

#PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
PROMPT+='${ret_status} %{$fg[cyan]%}%d%{$reset_color%} $(git_prompt_info)$ '

就會變成

 

 

4.Big Sur在使用mvn package的時候回遇到

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解決方法是在~/.bash_profile中加入

#java
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

# maven
export M2_HOME=/Users/lintong/software/apache-maven-3.6.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM