-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup_zsh.zsh
executable file
·33 lines (25 loc) · 940 Bytes
/
setup_zsh.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env zsh
echo "\n<<< Starting ZSH Setup >>>\n"
# Installation unnecessary; it's in the Brewfile.
# https://stackoverflow.com/a/4749368/1341838
if grep -Fxq '/usr/local/bin/zsh' '/etc/shells'; then
echo '/usr/local/bin/zsh already exists in /etc/shells'
else
echo "Enter superuser (sudo) password to edit /etc/shells"
echo '/usr/local/bin/zsh' | sudo tee -a '/etc/shells' >/dev/null
fi
if [ "$SHELL" = '/usr/local/bin/zsh' ]; then
echo '$SHELL is already /usr/local/bin/zsh'
else
echo "Enter user password to change login shell"
chsh -s '/usr/local/bin/zsh'
fi
if sh --version | grep -q zsh; then
echo '/private/var/select/sh already linked to /bin/zsh'
else
echo "Enter superuser (sudo) password to symlink sh to zsh"
# Looked cute, might delete later, idk
sudo ln -sfv /bin/zsh /private/var/select/sh
# I'd like for this to work instead.
# sudo ln -sfv /usr/local/bin/zsh /private/var/select/sh
fi