Why do you need to source .zshrc for every new shell in iTerm?
Solution 1
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
Solution 2
On starting a new shell just run the command source ~/.zshrc
by configuring in the
Preferences -> Profiles -> Select Default Profile(default profile will be starred) -> General -> Command -> Select Login Shell -> Send text at start:
Enter the value source ~/.zshrc
.
You may add source ~/.zshrc; clear
in case you need to clear the screen contents after executing the command.
Solution 3
I had the same issue and changing the Shells Open with
option fixed this for me.
To get here:
- Open Preferences for Terminal
- Select the General Tab
- Change Sells open with from
Default login shell
to Command (complete path) with the/bin/zsh
in the input box.
Screeshot:
Related videos on Youtube
![Trevor](https://i.stack.imgur.com/L0sqh.jpg?s=256&g=1)
Trevor
Updated on July 09, 2022Comments
-
Trevor almost 2 years
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
, orprofile
(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.
-
nevets1219 about 6 yearsYou probably didn't change your default shell : apple.stackexchange.com/questions/191780/…
-
chepner about 6 years@nevets1219 If that were the case, sourcing a Zsh configuration file would almost certainly cause an error. (Although I'm assuming that
zsh-autosuggestions.zsh
contains something thatbash
couldn't interpret properly.)
-
-
Trevor almost 6 yearsI'm pretty sure this was the solution I came to as well.
-
Faisal Ali over 2 yearschanging the Shells Open with option is a better Idea. you can find the steps in the above answers. cheers