Alex
Alex

Reputation: 38499

Need to reload bash every time i open terminal?

Every time I open terminal, I don't seem to have my bash profile loaded.
By this, I mean if I type:

git
node
brew

etc... i get "command not found"

If I run:

source ~/.bashrc

Then it fixes the issue. I seem to have to do this on each restart

Any way to make it do this automatically?

Upvotes: 1

Views: 10154

Answers (2)

Michael Wild
Michael Wild

Reputation: 26331

Presumably this is Mac OS X, right? The reason you see this behaviour is that Terminal.app creates a login shell, which only sources ~/.bash_profile or ~/.profile if the former doesn't exist. To solve your problem, either:

  • Source your ~/.bashrc from your ~/.bash_profile or ~/.profile
  • Put your commands in ~/.bash_profile or ~/.profile instead of ~/.bashrc
  • Configure Terminal.app to create a interactive non-login shell.

Upvotes: 3

yazu
yazu

Reputation: 4650

Add

source ~/.bashrc

in ~/.profile or ~/.bash_profile

Upvotes: 2

Related Questions