I am setting up ZSH with oh-my-zsh, and I want to preserve my .bashrc and .bash_aliases configurations.

From ~/.zshrc I read that:

Aliases can be placed here, though oh-my-zsh users are encouraged to define aliases within the ZSH_CUSTOM folder.

In the $ZSH_CUSTOM folder I find an example.zsh file that says:

You can put files here to add functionality separated per file, which will be ignored by git. Files on the custom/ directory will be automatically loaded by the init script, in alphabetical order.

Sounds great! Let's copy my bash files in there.

BUT it's not working! If I try one of my aliases I get:

zsh: command not found

I tried removing the dot from the files' names but no change.

What's happening?

(If I source the files manually it works.)

  • 1
    Why not just put the aliases in ~/.zshrc and skip the oh-my-zsh baggage?
    – thrig
    Sep 7 '16 at 14:54
  • Are you using oh-my-zsh or not? ZSH_CUSTOM is an oh-my-zsh thing. Sep 7 '16 at 22:52
  • @Gilles yes I am using oh-my-zsh, will edit to clarify. Sep 8 '16 at 9:30
  • 1
    Did you add the .zsh extension to your files?
    – Wieland
    Sep 8 '16 at 11:01
  • 1
    If we all think like you @thrig, we would still move with horses and ass animals ;)
    – Timo
    Nov 8 '20 at 14:08

Files you create in $ZSH_CUSTOM need to have a file extension of .zsh, according to the documentation:

oh-my-zsh's internals are defined in its lib directory. To change them, just create a file inside the custom directory (its name doesn't matter, as long as it has a .zsh ending)

If you just copied .bashrc and .bash_aliases into it, oh-my-zsh will therefore ignore them.

  • Going one step further: The diff between git.zsh and plugins/git/git.plugin.zsh in custom is that the latter has to be mentioned in the plugins list in .zshrc and goes in accordance with the plugins residing in /ohmyzsh.
    – Timo
    Nov 8 '20 at 14:20

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.