← Back to robbyrussell/oh-my-zsh

How to Deploy & Use robbyrussell/oh-my-zsh

Oh My Zsh Deployment and Usage Guide

1. Prerequisites

Before installing Oh My Zsh, ensure your system meets the following requirements:

ComponentRequirementVerification Command
ZshVersion 4.3.9+ (5.0.8+ recommended)zsh --version
GitVersion 2.4.11+ recommendedgit --version
Download Toolcurl, wget, or fetchwhich curl or which wget

Platform Compatibility

  • ✅ Linux (all distributions)
  • ✅ macOS (10.11+)
  • ✅ Windows (WSL2)
  • ✅ FreeBSD
  • ✅ Android (Termux)

Note: If Zsh is not installed, follow the Installing ZSH wiki instructions for your platform.

2. Installation

Method A: Automated Installation (Recommended)

Execute one of the following commands in your terminal:

Using curl:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Using wget:

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Using fetch (FreeBSD):

sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Alternative Mirror (for regions blocking GitHub raw content, e.g., China/India):

sh -c "$(curl -fsSL https://install.ohmyz.sh/)"

Security Note: The installer will rename any existing .zshrc to .zshrc.pre-oh-my-zsh before creating a new configuration.

Method B: Manual Installation (Air-gapped/Custom)

For environments without internet access or requiring manual review:

# Download installer for inspection
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
# Review the script, then execute
sh install.sh

Method C: Pure Git Installation

If you prefer complete manual control:

# Clone the repository
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh

# Create new Zsh configuration
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# Change default shell to Zsh
chsh -s $(which zsh)

3. Configuration

Oh My Zsh is configured through the ~/.zshrc file created during installation.

Essential Configuration Variables

Edit ~/.zshrc to customize your environment:

# Path to Oh My Zsh installation
export ZSH="$HOME/.oh-my-zsh"

# Theme selection (default: robbyrussell)
ZSH_THEME="robbyrussell"

# Plugin loading
plugins=(git docker node npm)

# Update behavior
zstyle ':omz:update' mode auto      # auto|disabled|reminder
zstyle ':omz:update' frequency 13   # days between checks

Custom Installation Directory

To install outside the default ~/.oh-my-zsh location:

# Set environment variable before running installer
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh

Or for existing installations, modify ~/.zshrc:

export ZSH="/path/to/custom/oh-my-zsh"

Enabling Plugins

Modify the plugins array in ~/.zshrc:

# Example: Development workflow
plugins=(git docker-compose kubectl npm yarn node python pip)

# Load order matters: last plugin takes precedence for aliases

Popular Plugin Categories:

  • Version Control: git, git-flow, mercurial
  • Containers: docker, docker-compose, kubectl, helm
  • Languages: node, npm, python, pip, ruby, rvm, golang, rust
  • System: sudo, systemd, ufw, firewalld
  • Cloud: aws, azure, gcloud, terraform

Theme Selection

Change the ZSH_THEME variable in ~/.zshrc:

# Built-in themes (140+ available)
ZSH_THEME="agnoster"      # Powerline-style
ZSH_THEME="powerlevel10k/powerlevel10k"  # External theme
ZSH_THEME="random"        # Random theme per session

Note: External themes may require additional installation steps. See the Themes Wiki.

4. Daily Usage

Starting Oh My Zsh

After installation, start a new terminal session or run:

zsh

To make Zsh your default shell permanently:

chsh -s $(which zsh)

Plugin Usage

Plugins provide aliases, functions, and auto-completion:

# Git plugin examples (loaded automatically)
gst    # git status
gco    # git checkout
gp     # git push
gl     # git pull

# Docker plugin examples
dps    # docker ps
dcup   # docker-compose up

Update Management

Automatic Updates: Oh My Zsh checks for updates automatically based on your zstyle configuration.

Manual Updates:

omz update

Disable Updates (Enterprise environments):

zstyle ':omz:update' mode disabled

Async Git Prompt (Performance)

For large repositories, enable async git prompt in ~/.zshrc:

zstyle ':omz:alpha' git-async yes

5. Enterprise Deployment

Unattended Installation

For automated deployment across multiple machines:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -- --unattended

Flags:

  • --unattended: No interactive prompts, skips change of default shell
  • --skip-chsh: Skip changing default shell
  • --keep-zshrc: Don't replace existing .zshrc

Installing from Forked Repository

For organizations maintaining custom forks:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
  -- --unattended --repo=https://github.com/yourcompany/ohmyzsh.git

Configuration Management Integration

Ansible Example:

- name: Install Oh My Zsh
  shell: |
    sh -c "$(curl -fsSL https://install.ohmyz.sh/)" -- --unattended
  args:
    creates: ~/.oh-my-zsh

- name: Deploy custom zshrc
  template:
    src: zshrc.j2
    dest: ~/.zshrc

Docker Integration:

RUN sh -c "$(curl -fsSL https://install.ohmyz.sh/)" -- --unattended \
    && sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/' ~/.zshrc

6. Troubleshooting

Installation Issues

Permission Denied:

# Fix ownership
sudo chown -R $(whoami) ~/.oh-my-zsh
chmod 755 ~/.oh-my-zsh

Zsh Not Found After Installation:

# Verify installation
which zsh

# If not in /etc/shells, add it:
command -v zsh | sudo tee -a /etc/shells

# Change shell manually
chsh -s $(which zsh)

Corrupted Installation:

# Reinstall cleanly
rm -rf ~/.oh-my-zsh
sh -c "$(curl -fsSL https://install.ohmyz.sh/)"

Configuration Issues

Plugins Not Loading:

  • Verify plugin names are comma-separated without spaces: plugins=(git docker) not plugins=(git, docker)
  • Check for typos in plugin names
  • Ensure source $ZSH/oh-my-zsh.sh exists in .zshrc

Theme Not Displaying Correctly:

  • Install a Nerd Font for icon support
  • Check terminal emulator compatibility
  • Verify TERM environment variable: export TERM=xterm-256color

Slow Prompt (Git Repository Lag):

# Disable git dirty check for large repos
git config --global oh-my-zsh.hide-dirty 1

# Or disable status entirely
git config --global oh-my-zsh.hide-status 1

Update Issues

Update Failed/Conflict:

# Reset to stable state
cd ~/.oh-my-zsh && git reset --hard origin/master
omz update

Stuck Update Prompt:

# Disable auto-update checks
zstyle ':omz:update' mode disabled

# Or set longer interval
zstyle ':omz:update' frequency 30

macOS Specific

"command not found: compaudit":

# Fix completions permissions
compaudit | xargs chmod g-w

Homebrew Plugin Issues: Ensure Homebrew is in PATH before Oh My Zsh loads:

# In ~/.zshrc, before source $ZSH/oh-my-zsh.sh
eval "$(/opt/homebrew/bin/brew shellenv)"