Skip to content

Commit 1b35224

Browse files
authored
Add .zshrc to install script
Add check for `.zshrc` after `.zprofile` to enable installing on a wider linux platform base. Also Make it so that `$PATH` is not modified if `usr/local/bin`lready exists on path in `.zshrc`. The install script fails if there is only .zshrc but no .zprofile. This is a common setup as .zshrc is actually the place to declare packages etc. for use in any interactive shell and .zprofile is supposed to be only for login shells: [See unix.stackexchange discussion](https://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout).
1 parent a6f6c20 commit 1b35224

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ if [ "$answer" == "Yes" ] || [ "$answer" == "yes" ] || [ "$answer" == "y" ] || [
5151
echo 'export PATH=$PATH:/usr/local/bin' >>~/.zprofile
5252
echo "OpenAI key and chatgpt path added to ~/.zprofile"
5353
source ~/.zprofile
54+
# zshrc profile, used for interactive shells in linux
55+
elif [ -f ~/.zshrc ]; then
56+
echo "export OPENAI_KEY=$key" >>~/.zshrc
57+
if [[ ":$PATH:" == *":/usr/local/bin:"* ]]; then
58+
echo 'export PATH=$PATH:/usr/local/bin' >>~/.zshrc
59+
fi
60+
echo "OpenAI key and chatgpt path added to ~/.zshrc"
61+
source ~/.zshrc
5462
# bash profile mac
5563
elif [ -f ~/.bash_profile ]; then
5664
echo "export OPENAI_KEY=$key" >>~/.bash_profile

0 commit comments

Comments
 (0)