-1

I was installing iterm2 on my mac (Ventura 13.4.1). While I was changing iterm2 config (installed oh-my-zsh and powerlevel10k, added plugins) I accidently ran source ~/.zshrc on my mac built-in terminal and now see this

How do I revert it to the original terminal?

Any help would be appreciated! Thanks!

I tried to modify zshrc because I thought mac terminal is zsh but didn't work.

romainl
  • 186,200
  • 21
  • 280
  • 313
Jun
  • 1
  • 2
  • In general, if a program does some modifications, and you want to have the old state back, you have to do it manually. It's like when a program for instance changes some files - you have to restore the changed ones from your backup. Therefore, what you want to do is impossible, unless you know all the changes and undo them. But if you have a backup of your zsh startup files, just throw away the current terminal session, restore the files from backup, and start a new terminal session. – user1934428 Jul 21 '23 at 11:05
  • Just start a new shell that gets configured with the fixed `.zshrc`. In general, you cannot "undo" what's already been done, because the shell doesn't remember what state it was in *before* sourcing a file. – chepner Jul 26 '23 at 17:54

1 Answers1

0

~/.zshrc file should be the configuration of your shell. Since Mac OS Catalina zsh is the default terminal in Mac OS.

You should edit ~/.zshrc to fix your zsh prompt and then source again the file configuration.

source ~/.zshrc

PXP9
  • 358
  • 1
  • 8
  • Hi @PXP9 Thanks for the reply. So, to my understanding, I have to revert my zshrc file and source again on macos terminal. But then I lose all the config I made in zshrc for iterm2. Then the only solution is reset zshrc, source it on macos terminal, and redo the iterm2 config again, right? – Jun Jul 20 '23 at 22:31
  • Nope, I have suggested you to fix zsh conf file `~/.zshrc` which is different to revert it. You need to find what is causing that you see like that the prompt. – PXP9 Jul 20 '23 at 22:35
  • Maybe the font family is causing it. I would recommend you to set a monospace font that has a lot of characters. Take a look to [Nerd Fonts](https://www.nerdfonts.com/) – PXP9 Jul 20 '23 at 22:38
  • Thanks @PXP9, I started using this macbook yesterday (i.e., I haven't had chance yet to edit zshrc except for iterm2) so all the lines in zshrc are related to the config I made for iterm2. So I just deleted all the lines in zshrc and sourced it on mac terminal which gave me default terminal. But after I copy back all the config in zshrc and source it on iterm2, my mac terminal changes again. So I guess, as two terminals are sharing the same zshrc file, I don't think I can stop mac terminal from being changed..? – Jun Jul 20 '23 at 23:00
  • `.zshrc` file It is call when you open a zsh shell, it is independent of the terminal you open. The terminal it is just the window of the CLI(command line interface) and the shell is the engine that makes work in the CLI. So every time you open a terminal a zsh is opened and `zshrc` is sourced. I would recommend you to use `ohmyzsh` framework because it gives you a fully functional conf , and you can change theme easily. – PXP9 Jul 21 '23 at 06:32
  • Thx @PXP9. I solved the issue by adding if else statement in `.zshrc`. Your comments helped a lot understanding what's going on under the hood. – Jun Jul 21 '23 at 15:23