I want to start using zsh as recommended by Apple for Mac OS Catalina. How do I migrate my aliases that I have defined in the ~/.bash_profile to the new shell?

1 Answer 1


If until now you've been using ~/.bash_profile for the loading the aliases, here are some of the ways you can migrate your aliases:

1. Copy the contents:

The most assiduous and obvious way is to copy the contents of your ~/.bash_profile to ~/.zshrc. It works particularly when you are moving on from bash to zsh for good.

2. Pull out aliases and then source them:

Another *way is:

  1. Create a new file that will contain the aliases (let's call it ~/.aliases);
  2. Copy the contents of ~/.bash_profile to the new aliases file;
  3. Modify the ~/.bash_profile and ~/.zshrc to source the new file.

Put the following in ~/.bash_profile:

if [ -f ~/.aliases ]; then
   . ~/.aliases

and put the following in ~/.zshrc:

source $HOME/.aliases

This way the aliases will be available for both shells. More importantly, if you make changes to the aliases, the changes will cascade to both shells automatically.

* Taken from here

  • 1
    This answer was the solution for me. Thanks @displayName
    – DanRan
    Mar 16, 2021 at 9:52

You must log in to answer this question.

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