I am trying to get ZSH config working correctly on Mac OSX. I installed it using curl: curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
. Then I modified my zshrc file to fit my needs. It works only after I run source ~/.zshrc
. But then if I come back and open a new tab or new terminal I have to do source ~/.zshrc
to get the config settings to work again. Has anybody ran into this issue? I believe there is a way to make it so I don't have to do source ~/.zshrc
with every new tab.
I figured this out. It was due to my config file. The part of the zsh config that wasn't loading needed to be moved down after the plugins load. After moving that it all worked as expected.
plugins=(osx git )
then source $ZSH/oh-my-zsh.sh
. –
Verde $ZSH/oh-my-zsh.sh
–
Menides If you have themes like Powerlevel9k installed for your zsh
shell then source the oh-my-zsh config file after the theme variable assignments in your .zshrc
file like shown below.
Eg:
........
........
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=('status' 'load' 'ram_joined' 'time')
# source oh-my-zsh config
source $ZSH/oh-my-zsh.sh
Not the ideal solution but solves the issue:
Terminal -> Preferences -> Profiles -> Shells -> Startup
Check the box that says "Run command" and in the input box run
source ~/.zsh/.zshrc
This will be executed when you open a new terminal window / tab.
My final solution was to go to Terminal --> Preferences --> General --> Shells open with --> Command (complete path), and set it to /bin/zsh (or your path to zsh), and then set both New windows/tabs open with to "Same profile". It works fine for me.
My initial attempt was to go to Terminal --> Preferences --> Profiles, and in my default profile's "shell" tab's Startup section, I set it to run command "source ~/.zshrc". This also solved the problem of /.zshrc not loading, but it seemed tedious to see that command show on every terminal tab/window.
I had a similar problem. I found that I had long ago changed my Terminal preferences to run tcsh instead of the default login shell. Took me forever to figure this out!
On mac zsh it is loading ~/.zsh_profile on shell start. So just create one like this will do.
echo "source ~/.zshrc" > .zsh_profile
Or just put your .zshrc content into .zsh_profile. Whatever works for you.
ln -s ~/.zshrc ~/.zsh_profile
–
Eurhythmics © 2022 - 2024 — McMap. All rights reserved.
/etc/zshenv
), if that is set it determines from where .zshrc is read, and only if not set it takes ~/.zshrc . Also see zsh manpage (It has been a while since I usedzsh
) – Spaceportzsh
on Mac OS X should work without requiring you tosource ~/.zshrc
so I'll ask a possibly stupid question: have you set your shell tozsh
(default isbash
)? – Horan