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
![Location of .zshrc fie macOS Location of .zshrc fie macOS](https://code2care.org/zsh/where-is-zshrc-file-located-in-macos/images/Location of zshrc fie macOS.png)
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
![Locate Local dot zsh files Mac Locate Local dot zsh files Mac](https://code2care.org/zsh/where-is-zshrc-file-located-in-macos/images/Locate Local dot zsh files Mac.jpg)
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
![System Level zshrc file editing using nano editor example System Level zshrc file editing using nano editor example](https://code2care.org/zsh/where-is-zshrc-file-located-in-macos/images/System Level zshrc file editing using nano editor example.jpg)
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.
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Fix: grunt: command not found (Mac/Windows)
- AppleScript Example with TextEdit
- How to copy Password of Wifi on your Mac
- Install OpenJDK Java (8/11/17) versions using brew on Mac (Intel/M1/M2)
- How to check if a port is in use using terminal [Linux or macOS]
- Cut, Copy and Paste Keyboard Shortcuts on Mac Keyboard
- [macOS] NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK XX or newer is required.
- How to Remove Widgets from macOS Sonoma 14 Desktop
- Turn off Auto-Capitalization on macOS Ventura 13
- How to Go To /usr/local/bin on Mac Terminal?
- How to Open TextEdit on Mac
- Mac: How to Open Android Studio from Terminal
- How to change the default location of Mac Screenshot
- Display Seconds in Digital Clock on Mac Menu Bar [macOS]
- How to install homebrew (brew) on M1 Mac
- Must Know Homebrew Commands for Mac/Linux Users
- Steps to Uninstall Roblox on Mac (macOS)
- How to change the System Settings Sidebar icon size Mac Ventura 13
- How to set Out Of Office (OOO) on Outlook for Mac [Updated 2023]
- Trigger Notification Center Message using Mac Terminal Command
- [fix] macOS Ventura - Python3 xcrun: error: invalid active developer path missing xcrun at CommandLineTools
- How to Install Rust Language on Mac (macOS)
- How to minimize all Windows in Mac
- Display ls command file sizes in KB (kilobytes) MB (megabytes) or GB (gigabytes) [Linux/macOS]
- How to make TextEdit the default text Editor on Mac
- 🎃 Trending, Popular Halloween hashtags for year 2020 🎃 [Facebook, Twitter, Instagram, Snapchat] - Hashtags
- How to enable more encoding support in Mac Terminal - MacOS
- Integrating Android Facebook SDK 3.17.2 Tutorial - Android
- Fix: IntelliJ No SDK for New Project - Java
- Android : Error in http connection java.net.SocketException: Permission denied - Android
- How to install node on macOS Ventura/Sonoma - HowTos
- wget Command on macOS Terminal - MacOS
- How to Upgrade Mac from Monterey to macOS Ventura - MacOS