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!
- Opening mac Terminal
- How to change default macOS Terminal Window size
- How to clear Mac Terminal screen
- Find Hostname of Mac running on macOS Ventura 13
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to switch from bash to zsh shell in macOS Terminal
- Limit scrollback rows in macOS Terminal
- How to Set Background Wallpaper on macOS 13 Ventura
- This operation couldnt be completed. Unable to locate a Java Runtime. [macOS]
- Encode or Decode Base64 String using Mac Terminal Command
- List of All Apple Silicon ARM Based M1/M2 Mac [updated Oct 2022)
- How to remove Siri from Menu Bar [macOS Big Sur]
- Must Know Homebrew Commands for Mac/Linux Users
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- 13.0 MacOS Ventura release date
- How to change the default location of Mac Screenshot
- How to set Out Of Office (OOO) on Outlook for Mac
- 30+ Zoom video communications application shortcuts for macOS
- How to install wget on macOS
- Mac turn dark mode on or off using terminal command
- Create Symbolic Link using Terminal Command
- Mac - How to Install VirtualBox
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to install homebrew (brew) on M1 Mac
- How to uninstall Microsoft Outlook on Mac
- SQL: Check if table exists - HowTos
- [fix] Docker - no matching manifest for linux/arm64/v8 in the manifest list entries [M/M2 Mac] - Docker
- How to identify the version of IntelliJ - HowTos
- How to remove or unstage a file from git staged area - Git
- How to Schedule Mails in macOS Ventura - MacOS
- How to check file permissions for your file using Linux/Unix/macOS Terminal Command - Linux
- Display full website URL/address in Safari macOS Browser - MacOS
- How to install homebrew (brew) on M1 Mac - MacOS