macosterminalzshzshrczsh-alias

How can I permanently remove an added alias from zsh (MacOS Terminal)?


I'm using MacOS and had the issue that my Terminal didn't react to the 'python' command, so I tried out what was recommended here (manually adding an alias to zsh with echo "alias python=/usr/bin/python3" >> ~/.zshrc).

Turned out this wasn't the perfect solution in my case, so I'd like to reverse it.

I tried the 'unalias' command, but this only works for the length of the Terminal session. If I reboot Terminal, the alias is still there. Is there a permanent way how to delete this manually added alias?


Solution

    1. Open the .zshrc file using any text editor.
    2. Go to the bottom of the file.
    3. Delete the line that says `alias python=/usr/bin/python3"
    4. Save and exit.

    Voila.

    The echo command combined with >> is just appending alias... to the bottom of the .zshrc file, deleting this line will get rid of the alias permanently.