27

I’m using iTerm and wanted to customize the look of my terminal window using Oh My ZSH!. And according to the documentation I need to change the ~/.zshrc file and add a ZSH_THEME value:

Once you find a theme that you want to use, you will need to edit the ~/.zshrc file. You'll see an environment variable (all caps) in there that looks like:

ZSH_THEME="robbyrussell"

The problem is I don’t know where to find the ~/.zshrc file.

  • 1
    The tilde (~) refers to your home directory where .zshrc is typically installed and checked for. That's your per-user file that you can create and change to your liking. There's also a global config one in /etc/zshenv, but I wouldn't touch that one. – Erikster Mar 6 '15 at 0:16
38

The ~/.zshrc doesn’t exist by default in Mac OS X so you need to create it. The ~/ translates to your user’s home directory and the .zshrc is the ZSH configuration file itself.

So just open up a “Terminal” or “iTerm” window and create that file like this; I am using nano as a text editor but feel free to use whatever text editor you feel comfortable with:

nano ~/.zshrc

And then set the ZSH_THEME value to whatever value you want to use like this:

ZSH_THEME="robbyrussell"

Now to save the file in nano just hit ctrl+X. When it prompts:

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Just type “Y” and then you will get a new prompt which looks something like this; just note the path /Users/jake/ will match your local user’s path:

File Name to Write: /Users/jake/.zshrc

Now just hit return and the file will be saved and you will now be back to the command line prompt in the “Terminal” or “iTerm.” If you now exit from the “Terminal” or “iTerm” and then open a new window, the ~/.zshrc settings should now be loaded in.

  • Thanks! Hmm so I created a new .zshrc file, but now when I run ~/.zshrc I get a permission denied error? Have you run into that? – Leon Gaban Mar 6 '15 at 0:43
  • 1
    @LeonGaban What do you mean “…but now when I run ~/.zshrc I get a permission denied error?” You don’t run ~/.zshrc. It’s simply a configuration file ZSH reads to use. How to use ZSH is out of the scope of this question so I encourage you to read up more on how to use ZSH on your Mac. – JakeGould Mar 6 '15 at 0:48
  • 1
    Yea I found those docs, but reading that is like sandpaper on the eyes :( found this tutorial :) much better, thx! youtube.com/watch?v=Tz4kScOIOW0 – Leon Gaban Mar 6 '15 at 1:17
5

I am using macOS High Sierra, MacBook Pro.

After I installed a Theme, I also needed to change the ZSH_THEME.

For me, ~/.zshrc was already present in my Home directory, but it was Hidden.

I used Cmd + Shift + . to show the hidden files in Finder, then opened the ~/.zshrc files with my editor. Updated it and saved it. It worked fine.

0

Mac OS Catalina

The .zshrc file is not present by default, we need to create it.

Steps for creation:

  1. Open Terminal
  2. Type touch ~/.zshrc to create the respective file. (touch command will create the .zshrc in your current directory but it will be hidden )
  3. Hit return

To view/open ~/.zshrc you can do either of two things:

  1. Open Finder => Press Cmd + Shift + .

============= OR ====================

  1. Open Terminal => Type open ~/.zshrc
New contributor
iCantC is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.