1. 啓動終端Terminal
2. 進入當前用戶的home目錄
輸入cd ~
3. 建立.bash_profile
輸入touch .bash_profilejavascript
在導入並應用完顏色方案以後,經過命令vim ~/.bash_profile
或open ~/.bash_profile
編輯文件,添加如下內容,以後source ~/.bash_profile
來應用文 件修改。java
4. 編輯.bash_profile文件
輸入open -e .bash_profilevim
CLICOLOR=1 LSCOLORS=gxfxcxdxbxegedabagacad export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ ' export TERM=xterm-color
5. 保存文件,關閉.bash_profile
6. 更新剛配置的環境變量
輸入source .bash_profilebash
7. 這樣以後ls仍是不能顯示顏色,須要指定ls -G
才能顯示顏色,這裏咱們能夠爲它配置別名,經過命令vim ~/.bashrc
或open ~/.bashrc
編輯文件,添加如下內容, 以後source ~/.bashrc
來應用修改。code
alias ll='ls -lG' alias ls='ls -G'
保存後還需對 .bash_profile 進行一些設置。打開 .bash_profile 文件,添加如下內容。blog
if [ -f ~/.bashrc ]; then source ~/.bashrc fi