自分で書いた「HomesteadでRuby on Railsの環境構築」を元に環境を作った所、.bash_profile
という設定ファイルをいじったらターミナルのカラーがすべて白に変わってしまった.
解決方法
結論から先に書くと.bash_profile
に以下の処理を追記すれば解決する。
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
vimで上記の処理を追記
$ vim ~/.bash_profile
.bash_profile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
追記しただけでは変更が反映されないので、sourceコマンドを打つ。
$ source .bash_profile
これで変更が反映される。
原因
カラー等の設定は~/.bashrc
に色々書いてありここを参照していたっぽい
$ vim ~/.bashrc
.bashrc
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
..(以下省略)..
設定ファイルは.bash_profile
-> .bashrc
の順に実行されるそうなので、新たに作成したことによって.bash_profile
しか読み込まれなかったっぽい。
「HomesteadでRuby on Railsの環境構築」で追加した処理しか書いてなかったのでもともとファイル自体なかったのかも!?
.bash_profile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
なので.bashrc
も読み込まれるような処理を追加すればできた感じ。