LoginSignup
2
1

More than 5 years have passed since last update.

Homesteadで.bash_profileをいじったらターミナルの文字が白くなった

Last updated at Posted at 2019-05-25

自分で書いた「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も読み込まれるような処理を追加すればできた感じ。

参考記事

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1