Where is zshrc on mac

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 17, 2026

Quick Answer: The .zshrc file on macOS is located in the user's home directory at ~/.zshrc. It is a hidden file created when customizing the Z shell environment and is used to set aliases, environment variables, and startup configurations.

Key Facts

Overview

The .zshrc file is a configuration script used by the Z shell (zsh) on macOS systems. Since the release of macOS Catalina in October 2019, Apple has set zsh as the default login shell, replacing Bash. This change shifted user customization from .bash_profile to .zshrc for terminal preferences.

The file is stored in the user's home directory and is hidden by default due to the leading dot in its name. It runs automatically each time a new terminal session starts, allowing users to define aliases, environment variables, and prompt themes. Proper management of this file is essential for developers, system administrators, and power users.

How It Works

The .zshrc file functions as an initialization script that configures the Z shell environment upon login. It supports scripting syntax compatible with Bourne shell and includes advanced features like globbing, command-line completion, and theme support through frameworks.

Comparison at a Glance

Below is a comparison of shell configuration files across different macOS versions and shells:

Shell TypeConfig FileDefault SinceLocationVisibility
Bash.bash_profilemacOS 10.0 (2001)~/.bash_profileHidden
Zsh.zshrcmacOS Catalina (2019)~/.zshrcHidden
Custom Zsh.zprofile, .zloginN/A~/.zprofileHidden
System-wide/etc/zshrcAll versions/etc/zshrcVisible
Framework.oh-my-zsh/custom2009 (framework)~/.oh-my-zsh/Hidden

This table highlights the evolution of shell configuration on macOS. While system-wide settings exist in /etc/zshrc, user-specific preferences are managed in ~/.zshrc. The shift to zsh has encouraged widespread adoption of tools like Oh My Zsh, which simplify configuration through modular plugins.

Why It Matters

Understanding the location and function of .zshrc is critical for anyone using the macOS terminal for development, automation, or system administration. Misconfiguration can lead to broken environments, while optimization can significantly boost workflow efficiency.

Mastering .zshrc empowers users to fully leverage the macOS terminal, turning a basic command line into a powerful, tailored tool for modern computing needs.

Sources

  1. WikipediaCC-BY-SA-4.0

Missing an answer?

Suggest a question and we'll generate an answer for it.