If you are using the Zsh shell, the default shell for Mac since the release of macOS Catalina, and trying to locate the .zshrc file, you must first know that this file is not created by default, you need to create one, if you think you already created one and want to locate it, here is how you can do that,
✌️ Note: If you install Oh My Zsh the zshrc file is auto-created.
How to locate the user level .zshrc file?
- Open Spotlight Search,
- Type Terminal and open it,
- Now type cd ~ to move to your user folder,
- Type ls -a, to see all the files (-a option to see hidden files),
- You should be able to see the .zshrc file, if not you do not have it
You can type just one command to view the files content,
% cat ~/.zshrc
If the file is not present you will get the below error!
cat: /Users/code2care/.zshrc: No such file or directory
An easy way to create and add text to the file is by nano (or vi) text editor nano ~/.zshrc
✌️I changed the prompt of Zsh from % to an emoji: 🦋, if you would like to do something similar follow the article: https://code2care.org/zsh/how-to-set-an-emoji-as-zsh-terminal-prompt-macos
Below is a ls command piped with grep tp see all the hidden .zsh files on a Mac using Terminal command.
% ls -la | grep '\.zsh.*'
-rw-r--r-- 1 code2care staff 38 Mar 12 2022 .zprofiley
-rw-------@ 1 code2care staff 21198 Oct 10 13:29 .zsh_history
drwx------ 43 code2care staff 1376 Oct 12 17:34 .zsh_sessions
-rw-r--r-- 1 code2care staff 29 Jun 27 22:48 .zshenv
-rw-r--r-- 1 code2care staff 266 Sep 11 16:39 .zshrc
-rw-r--r-- 1 code2care staff 42 Jan 26 2022 .zshrcy

How to locate the system level .zshrc file?
You can find the system level .zshrc file where all the system's configuration files live i.e. the /etc
- Open Mac Terminal,
- Move to /etc directory: cd /etc
- You will find a zshrc file here (this is not a hidden file),
- Open this file using nano or vim editor: vi zshrc

Note: If you make any changes in the /etc/zshrc file, the changes will be applied to all users on the Mac even if the .zshrc file is not available for any user or now.
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!

Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!