I am using this configuration on my mac(unix) to customize my shell. I am using zsh instead of bash and there are too many things along with zsh. This .dotfile configuration contains vim, zsh, git, homebrew, nvm, nginx, neovim and there respective themes and configurations. With Oh-my-zsh I can customize so many themes but here zsh is controlling my shell and ~/.zshrc is a symlink created with .dotfiles/zsh/zshrc.symlink file which I am using from Github's .dotfile bundle. I have renamed oh-my-zsh's version of zshrc file to ~/.zshrc.bak. Also, adding theme configuation to zsh's version of ~\zshrc file doesn't work. How, can I change theme with zsh?

zshrc's symlink from ~/.dotfiles

❯ cat ~/.zshrc
# Ruby Motion android tool
export RUBYMOTION_ANDROID_SDK=/Users/abhimanyuaryan/.rubymotion-android/sdk
export RUBYMOTION_ANDROID_NDK=/Users/abhimanyuaryan/.rubymotion-android/ndk

export DOTFILES=$HOME/.dotfiles
export ZSH=$DOTFILES/zsh

# display how long all tasks over 10 seconds take
export REPORTTIME=10

[[ -e ~/.terminfo ]] && export TERMINFO_DIRS=~/.terminfo:/usr/share/terminfo

# define the code directory
# This is where my code exists and where I want the `c` autocomplete to work from exclusively
if [[ -d ~/code ]]; then
    export CODE_DIR=~/code

# source all .zsh files inside of the zsh/ directory
for config ($ZSH/**/*.zsh) source $config

if [[ -a ~/.localrc ]]; then
    source ~/.localrc

# initialize autocomplete
autoload -U compinit

for config ($ZSH/**/*completion.sh) source $config

export EDITOR='nvim'

export PATH=/usr/local/bin:$PATH

# add /usr/local/sbin
if [[ -d /usr/local/sbin ]]; then
    export PATH=/usr/local/sbin:$PATH

# adding path directory for custom scripts

# check for custom bin directory and add to path
if [[ -d ~/bin ]]; then
    export PATH=~/bin:$PATH

[ -z "$TMUX" ] && export TERM=xterm-256color

# install rbenv
if hash rbenv 2>/dev/null; then
    eval "$(rbenv init -)"

if [[ -d ~/.rvm ]]; then
    PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting
    source ~/.rvm/scripts/rvm

# alias git to hub
if hash hub 2>/dev/null; then
    eval "$(hub alias -s)"

# source nvm
export NVM_DIR=~/.nvm

if hash brew 2>/dev/null; then
    source $(brew --prefix nvm)/nvm.sh
    source `brew --prefix`/etc/profile.d/z.sh

# Base16 Shell
# if [ -z "$THEME" ]; then
    export THEME="base16-eighties"
# fi
if [ -z "$BACKGROUND" ]; then
    export BACKGROUND="dark"

# [[ -s $BASE16_SHELL ]] && source $BASE16_SHELL
source $BASE16_SHELL

oh-my-zsh's version of zshrc file which doesn't work.

❯ cat .zshrc.bak
# Path to your oh-my-zsh installation.
export ZSH=/Users/abhimanyuaryan/.oh-my-zsh



# User configuration

export PATH="/Users/abhimanyuaryan/bin:/usr/local/bin:/Users/abhimanyuaryan/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
# export MANPATH="/usr/local/man:$MANPATH"

source $ZSH/oh-my-zsh.sh

Even if I add ZSH_THEME="agnoster" in ~/.zshrc. The theme doesn't change. It's still the same which Nick provided.

I asked him. He said your oh-my-zsh is clashing with my configurations. Create your own. I don't want to create my own because I am fairly new to all this stuff. Once I am good at tmux, vim, and all this stuff I'll create my own. Until then I just want to use this .dotfiles configuration. Please help me to customize my theme with this configuration. Also, Please help me to understand difference b/w zsh and oh-my-zsh.

  • 1
    Now it is 2017. What did you learn?
    – Timo
    Oct 22, 2017 at 7:07
  • 1
    Have you tried exporting instead of just setting ZSH_THEME? I have alias resource='source $ZSH/oh-my-zsh.sh' and alias restyle='(){ export ZSH_THEME="$@" && resource }', so for example, all I have to write is restyle sorin. (This expects export ZSH=~/path/to/oh-my-zsh.) (As an aside, some of my .zshrc is sensitive to double-sourcing, so I added include guards and generally just source oh-my-zsh.) For what it's worth, I tried setting ZSH_THEME without exporting, and it worked anyway. Please take a moment to update if you still have this environment or one like it.
    – John P
    Aug 28, 2018 at 15:44

2 Answers 2


Thanks to @John P above in the comments as it's really his answer but for those wanting a way to change zsh theme "on the fly" without editing and re-sourcing the config, simply define this alias in your .zshrc

alias ztheme='(){ export ZSH_THEME="$@" && source $ZSH/oh-my-zsh.sh }'


ztheme blinks
  • 1
    This is exactly what I wanted, thanks man. Aug 26, 2021 at 8:32

when you're done editing your ~/.zshrc, in a shell prompt run the command source ~/.zshrc. it will read the config from ~/.zshrc and it will apply it, it's like reload your config.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.