I am trying to use the aliases defined in my ~/.aliases file in my zsh with oh-my-zsh installation. The documentation suggested that aliases/functions/ etc. should go in .oh-my-zsh/custom/ as files with a .zsh extension.

I can make a file of aliases there using the keyword "alias" as normal. However, when I try making a file with the line "source ~/.aliases" -- this does not work.

What is the best way to go about this? Should I ditch the recommendation to use the oh-my-zsh/custom/ folder and instead source from .zshrc ?


You should just symlink your main file in the custom dir.

ln -s ~/.aliases ~/.oh-my-zsh/custom/aliases.zsh

My understanding is that you are trying to add your custom file aliases.zsh to the directory .oh-my-zsh/custom/

I just did this and tried using one of the aliases I defined in the file and it worked. Just make sure you restart your terminal's session and have the correct alias formatting alias zshconfig="mate ~/.zshrc"

  • I was trying to make an aliases.zsh file that consisted of a single line "source ~/.aliases" – Elfen Dew May 24 '18 at 4:16
  • 1
    I want to keep my alias dotfile ~/.aliases and have zsh source this file. I could only accomplish this by adding "source ~/.aliases" to the .zshrc file, but I was trying to follow the recommended format for adding custom aliases with oh-my-zsh. The reason I was doing it this way is because I wanted a single .aliases file independent of what shell I'm using. – Elfen Dew May 24 '18 at 4:21

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.