MAC 终端 与iTerm ~ 前后出现方框 ?的解决方法 和source ~/.bash_profile文件失效的解决方法

问题1:

MAC 终端 与iTerm ~ 前后出现方框 ?

解决如下:

MAC 终端 与iTerm ~ 前后出现方框 ?的解决方法 和source ~/.bash_profile文件失效的解决方法

问题原因:

主要是mac下oh-my-zsh配置主题的时候字体出了问题,关于波浪线~两边的两个问号问题,是因为配置中有非ascii字符编码,这两个问号本来是好看的箭头,但是箭头在当前字体中是不会被显示的,所以解决方法是重新下载一个支持非ascii编码的字体。

解决方法:

github上有一个字体:yizhen20133868/fonts

打开mac的terminal中执行以下代码:

1

2

3

4

5

6

8

# clone

git clone https://github.com/powerline/fonts.git

# install

cd fonts

./install.sh

# clean-up a bit

cd ..

rm -rf fonts

打开terminal的偏好设置-描述文件,点击 文本标签下的 字体的“更改”,课按照如下选择字体:

MAC 终端 与iTerm ~ 前后出现方框 ?的解决方法 和source ~/.bash_profile文件失效的解决方法

 

问题2:

source ~/.bash_profile文件失效

解决如下:

使用iTerm 安装了oh-my-zsh之后,就不再会每次开iTerm或者终端的时候,执行默认文件 ~/.bash_profile

而是去执行 .zshrc。

所以要到 .zshrc文件中加上source ~/.bash_profile。

1)进入到用户目录  /Users/用户名  下

2) vim .zshrc

3)在.zshrc最后加入source ~/.bash_profile

 

 

参考:

robbyrussell/oh-my-zsh#1906 (comment)

https://blog.csdn.net/liuchuo/article/details/79967960