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內容中。