In ~/.bash_profile I have :

if [ -f ~/.bashrc ]; then
    source ~/.bashrc

In ~/.bashrc I have some aliases

When I load a new iTerm window, my aliases do not work. If I source ~/.bashrc they work. If I source ~.bash_profile they work.

Isn't at least one of these supposed to be sourced automatically?

What might be causing it not to work properly?


The answer is simple, almost evident in the question. Here's why:

The shell zsh is not bash, it is a different shell. zsh will not use the default files built for bash: .bashrc or .bash_profile. These two files are startup configuration files for bash. zsh has its own startup configuration files.

You can find out more about them here on the zsh intro page:

There are five startup files that zsh will read commands from:


You had mentioned your aliases don't work, to fix this, apply your aliases here like so:


alias sz='source ~/.zshrc'     # Easily source your ~/.zshrc file.
alias ls='pwd; ls --color'     # Alias 'ls' to: pwd + ls + color.
  • Thank you. Note that ls --color gave me illegal option in both bash and zsh on OSX 10.10, but not on Linux -- I'll look into it. Cheers. – Bradley Flood Jul 10 '15 at 2:18
  • I don't have a Mac to test on but I think this has to do with the ls implementation on OS X, I don't think it has the - -color argument. If I remember I'll look it up. – projectdp Jul 10 '15 at 2:25
  • "... zsh has its own startup configuration files." this is what he probably asks for huh? just say "dude, it is ~/.zshrc". – eyurdakul Oct 15 '18 at 12:32
  • +1 great tips in the answer for macOS Catalina now using zsh officially. Thank you. – therobyouknow Nov 13 at 13:59

If you are using zsh then to force source .bash_profile

in ~/.zshrc add the line below

source ~/.bash_profile

P.S - I havent investigated whether this can cause any problem.

  • 2
    I guess this answer would be helpful after release of macOS 10.5 Catalina in order to port bash_profile from bash to zsh. – Oleksii Kyslytsyn Sep 29 at 12:23
  • Fast and effective! – Roberto Manfreda Oct 14 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.