You can permanently remove an added alias from zsh (MacOS Terminal) by editing your `.zshrc` file.

huangapple go评论67阅读模式
英文:

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?

英文:

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?

答案1

得分: 1

  1. 用任何文本编辑器打开 .zshrc 文件。
  2. 滚动到文件底部。
  3. 删除包含 alias python=/usr/bin/python3 的那一行。
  4. 保存并退出。

Voila.

echo 命令与 >> 结合使用,只是将 alias... 追加到 .zshrc 文件的末尾,删除此行将永久删除该别名。

英文:
  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.

huangapple
  • 本文由 发表于 2023年4月11日 00:45:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978953.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定