3

I'm running Catalina, 10.15.2, which uses the new zsh shell as a default. I've created my own .bash_profile file in my home directory and I'm able to initialize this .bash_profile by typing:

source .bash_profile

The problem is that I have to keep typing "source ..." each time I open a new terminal shell. How do I default the shell to always use this .bash_profile file? Thanks!

1
  • 1
    The default zsh config files are .zprofile/.zshrc. If your .bash_profile works with zsh you can simply rename it to .zprofile if no older/other .zprofile exists already... - In my env I sourced .zprofile in .zshrc.
    – klanomath
    Commented Jan 3, 2020 at 15:29

2 Answers 2

6

zsh uses different config files, see the 'STARTUP/SHUTDOWN FILES' section in man zsh. You can run one of

mv ~/.bash_profile ~/.zprofile
mv ~/.bash_profile ~/.zshrc

to rename the file, see the man page or https://support.apple.com/en-us/HT208050 for the difference between these:

If you're using a bash profile, such as to set environment variables, aliases, or path variables, you should switch to using a zsh equivalent. For example:

  • .zprofile is equivalent to .bash_profile and runs at login, including over SSH
  • .zshrc is equivalent to .bashrc and runs for each new Terminal session
2
1

You can also just add source .bash_profile at the bottom of your ~/.zshrc file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .