Preventing Customization Loss During Oh My Zsh Updates
Learn how to use $ZSH_CUSTOM to protect your Oh My Zsh plugins and themes from being overwritten during automatic updates, and how to manage update frequency.
28 Aug 2025, 04:00 UTC

The Problem: Vanishing Configurations After Updates
A common frustration with Oh My Zsh is the sudden disappearance of custom aliases, plugin modifications, or theme tweaks after an automatic update. This happens because the core installation directory (typically ~/.oh-my-zsh) is managed as a Git repository. When the framework updates, it performs a git pull or similar operation that overwrites modified files in the core tree to ensure the installation remains in a known, stable state.
The solution is to move all personal modifications into the $ZSH_CUSTOM directory. Files placed here are ignored by the update process and are loaded as overrides or additions to the core framework.
Diagnostic: Why Did My Changes Disappear?
If you notice your shell behavior changed after an update, use this table to identify the cause based on where you stored your changes.
| Symptom | Storage Location | Root Cause |
|---|---|---|
| Custom plugin logic is gone | ~/.oh-my-zsh/plugins/ |
Overwritten by core update |
| Theme colors/symbols reset | ~/.oh-my-zsh/themes/ |
Overwritten by core update |
| Custom aliases missing | Directly in oh-my-zsh.sh |
Overwritten by core update |
| Customizations persist | ~/.oh-my-zsh/custom/ |
Correct usage of $ZSH_CUSTOM |
Step-by-Step: Implementing Permanent Customizations
To ensure your configurations survive future updates, follow these steps to migrate your files to the custom directory. These instructions assume you are using a standard installation on a Unix-like system (Linux/macOS) with Zsh version 5.0+.
1. Verify the Custom Path
First, check where Oh My Zsh expects custom files. Run this command in your terminal:
echo $ZSH_CUSTOM
Expected Result: It should return ~/.oh-my-zsh/custom (or your specific override path). If it is empty, ensure you are sourcing oh-my-zsh.sh in your .zshrc.
2. Migrate Custom Plugins and Themes
If you have created your own plugins or modified existing ones, move them to the custom subdirectories. You must create these directories if they do not exist.
- For Plugins: Move your plugin folder to
$ZSH_CUSTOM/plugins/your-plugin-name. - For Themes: Move your
.zsh-themefile to$ZSH_CUSTOM/themes/your-theme-name.zsh-theme.
3. Update the .zshrc Configuration
Ensure your ~/.zshrc is configured to load these items. Open the file with your preferred editor and verify the following lines:
# Set the theme (this will look in $ZSH_CUSTOM/themes first)
ZSH_THEME="your-theme-name"
# Add your custom plugin to the list
plugins=(git zsh-autosuggestions your-plugin-name)
# Ensure $ZSH_CUSTOM is defined BEFORE sourcing oh-my-zsh.sh
export ZSH_CUSTOM="~/.oh-my-zsh/custom"
source $ZSH/oh-my-zsh.sh
Managing the Update Cycle
While $ZSH_CUSTOM protects your files, the update process itself can sometimes cause startup latency if your network is slow. You can control this behavior in ~/.zshrc.
Controlling Update Frequency
If you prefer to update manually or change the check interval, use these variables:
- Disable Auto-Updates: Add
DISABLE_AUTO_UPDATE="true"to your.zshrc. This stops the shell from checking for updates on startup. - Adjust Interval: Use
UPDATE_ZSH_DAYS=30to change the check frequency from the default (usually 13 days) to once a month.
Verification Check
To verify your setup is update-proof:
- Create a dummy file:
touch $ZSH_CUSTOM/test_persistence.txt. - Manually trigger an update:
omz update. - Check if the file still exists:
ls $ZSH_CUSTOM/test_persistence.txt.
If the file remains, your $ZSH_CUSTOM directory is correctly isolated from the core update process.
Limitations and Risks
- Dependency Conflicts: If you override a core plugin in
$ZSH_CUSTOM, the core version is ignored. If the core plugin receives a critical security update, your custom version will not receive it automatically. - Path Ordering: If
$ZSH_CUSTOMis defined aftersource $ZSH/oh-my-zsh.sh, the framework will use the default path, and your custom plugins may fail to load. - Permissions: Ensure the
customdirectory has the same ownership as the rest of the.oh-my-zshfolder to avoid permission denied errors during shell initialization.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.