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.
Have Questions? Post them here!
- How to check Command Line Tools Version [Updated for Ventura]
- Trigger Notification Center Message using Mac Terminal Command
- [macOS] How to search or view previous terminal command history
- Show/Hide Hidden Files and Directories on Mac Finder
- How to clear Mac Terminal screen
- Setting JAVA_HOME in macOS Big Sur
- How to find files taking up space on your Mac
- How to Show Battery percentage on Big Sur Menu Bar
- How to uninstall Microsoft Outlook on Mac
- Move from Zsh to Bash shell macOS
- Install Native Golang on M1/M2 ARM based Mac
- Shutdown Mac Terminal Command
- How to Refresh Mac Desktop
- How to Set Background Wallpaper on macOS 13 Ventura
- The Zsh Shell - Mac Tutorial
- Installing brew on M1/M2 ARM Mac
- Display Seconds in Digital Clock on Mac Menu Bar [macOS]
- How to Increase Mac Terminal Buffer Size
- Add Sketch from iPhone to MacBook with macOS Monterey
- How to view the desktop when using macOS Stage Manager?
- [fix] App store not working on Mac, Blank Black or White Screen
- [fix] How to Show file extensions on all files on Mac
- Limit scrollback rows in macOS Terminal
- How to open terminal on Mac to run commands
- Set Custom Background Wallpaper on Mac Terminal (macOS Ventura)
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command - Bash
- Java JDBC Connection with Database using SSL (https) URL - Java
- Visual Studio Code available for Apple Mac ARM64 build for native M1 processor support - Microsoft
- JSON Syntax : JSON Tutorial - Json-Tutorial
- Android Display Toast on Button Click - Android
- Install Cygwin on Windows PC to learn Objective-C - Objective-C
- List of Java Simple Date Formats (Cheatsheet) - Java
- How to add sleep in Powershell Script - Powershell