tonglin0325的个人主页

mac环境变量不生效问题

1.在 ~/.zshrc 中添加

1
2
source ~/.bash_profile 

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

 

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

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

1
2
source ~/.git-completion.bash

 

3.调整mac终端颜色和全路径显示

1
2
3
4
5
export PS1="%n@%m %0~ $ "

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

如果安装的oh my zsh,那么修改全路径显示的方式是

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

修改成

1
2
#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的时候回遇到

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

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

1
2
3
4
5
6
7
8
9
10
11
#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

  

5.iterm2连接远程终端中文乱码,在 ~/.zshrc 中添加

1
2
export LANG='UTC-8' export LC_ALL='en_US.UTF-8'

然后

1
2
source ~/.zshrc

  

6.oh my zsh添加提示插件

1
2
https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md