Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macOS Catalina 10.15(beta) - Why is ~/.bash_profile not sourced by my shell?

People also ask

How do I change the default shell to bash on macOS Catalina?

Hold the Ctrl key, click your user account's name in the left pane, and select “Advanced Options.” Click the “Login Shell” dropdown box and select “/bin/bash” to use Bash as your default shell or “/bin/zsh” to use Zsh as your default shell. Click “OK” to save your changes.

How do I get to bash profile on Mac?

Go the users home directory. Check if the bash_profile is visible there or not. If not, press Command + Shift + . and bash_profile will be visible.


Apple has changed the default shell to zsh. Therefore you have to rename your configuration files. .bashrc is now .zshrc and .bash_profile is now .zprofile.


If you for some reason (as me) don't want to rename/move your ~/.bash_profile file you can do the next things:

  1. Create a new file ~/.zprofile
  2. Type there source ~/.bash_profile
  3. Save and close
  4. Run a new terminal session

I created a new file called

/usr/local/bin/mybash

which contains a wrapper script:

/usr/local/bin/bash --init-file $HOME/.bashrc

I installed this local/bin/bash from HomeBrew.

Full Sequence of Events

brew install bash
echo "/usr/local/bin/bash --init-file $HOME/.bashrc" > /usr/local/bin/mybash
chmod +x /usr/local/bin/mybash

Then I opened the settings for terminal.app [cmd-comma]. Under the General Tab, select the radio button for Command (complete path)

In the text box change the text from /bin/zsh/ to /usr/local/bin/bash.

Example of final format


You can just copy your existing bash_profile and name it zprofile and it will work fine.

  • Run the below command in terminal and you are set after closing and opening new terminal.

cp ~/.bash_profile ~/.zprofile