1、打开terminal(终端)
2、cd ~ ( 进入当前用户的home目录)
3、open .bash_profile (打开.bash_profile文件,如果文件不存在就 创建文件:touch .bash_profile 编辑文件:open -e bash_profile)
4、直接讲下面的代码添加至弹出的.bash_profile文件内容中
export LANG="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8”
export LC_CTYPE="en_US.UTF-8”
export LC_MESSAGES="en_US.UTF-8”
export LC_MONETARY="en_US.UTF-8”
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL=
5、command + s 保存文件,然后关闭
6、在terminal(终端)中输入 source .bash_profile (使用刚才更新之后的内容)
当然,也会出现当source .bash_profile之后可能会出现报错,比如:
-bash: export: `3.6': not a valid identifier
-bash: .bash_profile: line 36: unexpected EOF while looking for matching `"'
-bash: .bash_profile: line 37: syntax error: unexpected end of file
这个时候可以将之前存在于.bash_profile文件内容剪切出来,只保留我们要添加进去的文件,然后再source .bash_profile。
等我们安装完毕之后再将剪切出来的东西去添加到.bash_profile内容中。