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.
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
- How to show line numbers in Nano on Mac
- How to install Jupyter Notebook on macOS Sonoma
- How to Disable Remote Management using Mac Terminal
- Test internet speed using macOS Terminal command
- Docker Desktop needs privileged access macOS
- Google Search Hot Trends Screensaver for Mac OS X
- How to do calculations in Mac Terminal
- How to make TextEdit the default text Editor on Mac
- How to Show Full Website Address on Safari for Mac (Ventura/Sonoma)
- The Zsh Shell - Mac Tutorial
- Opening mac Terminal
- How to change the name of your Mac running on macOS Ventura 13
- How to find the Battery Cycle Count on macOS Ventura
- How to set an emoji as Zsh terminal prompt in macOS
- How to access Trash Folder using Mac Terminal Command
- macOS Ventura XCode Command Line Tools Installation
- Hide Bluetooth icon on Mac Menu Bar macOS Ventura 13
- How to run .sh file in Mac Terminal
- Terminal Command to get the list of available shells in macOS
- How to see Storage Information on macOS Ventura
- How to Go To /usr/local/bin on Mac Terminal?
- How to do screen recording on Mac
- How to Find File and Directory Size in Mac Terminal
- Open .bash_profile File in TextEdit using Terminal
- Remove Now Playing icon from macOS Big Sur Menu Bar
- Set Custom Background Wallpaper on Mac Terminal (macOS Ventura) - MacOS
- Python 3.x - SQLite 3 Database CRUD Operations Examples - Python
- How to Freeze Top Row in Excel for Mac - Windows
- How to hide lines in Notepad++ - NotepadPlusPlus
- How to Run all Cells at Once Jupyter Notebook - Python
- How to hide or disable iOS 14 App Library on iPhone? - Apple
- Default speed of Marquee tag : SCROLLAMOUNT - Html
- [Solution] Java Error Code 1603. Java Update did not complete. - Java