2

I installed zsh on macOS via homebrew and set it as my default shell, along with installing oh-my-zsh.

I wanted to add my aliases to a separate file instead of cluttering up my .zshrc file. So I added the following line to the end:

. ~/.zsh_aliases

However, when I load a new shell, it spits out the error:

Last login: Sat Dec 28 00:53:25 on ttys001
/Users/username/.zsh_aliases:97: = not found

Even though if I just paste that path into the terminal and hit enter, it runs the file. The file exists and has +x permissions.

Furthermore, it seems that the aliases actually do work. It just displays the error.

Why am I getting the error?

2
  • 1
    What is line 97 of .zsh_aliases?
    – chepner
    Commented Jan 2, 2020 at 15:48
  • 1
    Perhaps you had a space in front of the equal sign in line 97 of .zsh_aliases? Commented Jan 3, 2020 at 8:50

1 Answer 1

0

Look into ZSH_CUSTOM in your .zshrc. set it to a sub-dir of your home-dir such as omz-custom

# Would you like to use another custom folder than $ZSH/custom?
 ZSH_CUSTOM=~/omz-custom

And then put your aliases in it and reload the shell.

mv ~/.zsh_aliases ~/omz-custom/alises.zsh && reload

Any file with a .zsh suffix will get loaded when the shell loads. I also recommend making your omz-custom dir a git repo and pushing it to github.

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