Why do you need to source .zshrc for every new shell in iTerm?

Trevor picture Trevor · Jun 5, 2018 · Viewed 39.3k times · Source

I've used Iterm2 with zsh everyday for the past 3 years, but I got a new computer and had to set it up again. The problem is that when I run ~/.zshrc it works fine, but I have to do it on every new terminal window I open. Not a good experience.

I noticed that I don't have any bashrc, bash_profile, or profile (dot)files on my new machine.

Here's the code in ~/.zshrc:

export ZSH=/Users/healy/.oh-my-zsh
plugins=(
  git
)
ZSH_THEME="agnoster"
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
DEFAULT_USER=healy

Again, it works perfectly (and as expected), but only after I run the source command, and that shouldn't be the case.

enter image description here

Answer

kenji picture kenji · Aug 26, 2018

Make sure your export/source are added after the plugins in your zshrc, as stated in this post: oh-my-zsh config file not loading