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?
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
~/.zshrc. It works particularly when you are moving on from
zsh for good.
2. Pull out aliases and then source them:
Another *way is:
- Create a new file that will contain the aliases (let's call it
- Copy the contents of
~/.bash_profileto the new aliases file;
- Modify the
~/.zshrcto source the new file.
Put the following in
if [ -f ~/.aliases ]; then . ~/.aliases fi
and put the following in
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