Skip to content

Instantly share code, notes, and snippets.

@atomlab
Forked from ZhaofengWu/install_zsh.sh
Created June 16, 2023 10:44
Show Gist options
  • Save atomlab/7e8122aef53b9c29ab883fd67603e3bb to your computer and use it in GitHub Desktop.
Save atomlab/7e8122aef53b9c29ab883fd67603e3bb to your computer and use it in GitHub Desktop.
Install zsh without root
#!/bin/bash
set -e
# zsh will not install without ncurses. If the machine doesn't have this library, it will need to be installed first.
export CXXFLAGS=" -fPIC" CFLAGS=" -fPIC" CPPFLAGS="-I${HOME}/include" LDFLAGS="-L${HOME}/lib"
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz
tar -xzvf ncurses-6.2.tar.gz
cd ncurses-6.2
./configure --prefix=$HOME --enable-shared
make
make install
cd .. && rm ncurses-6.2.tar.gz && rm -r ncurses-6.2
wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh --strip-components 1
cd zsh
./configure --prefix=$HOME
make
make install
cd .. && rm zsh.tar && rm -r zsh
echo -e "export SHELL=~/bin/zsh\nexec ~/bin/zsh -l" >> ~/.bash_profile # or chsh
# Optional: install oh-my-zsh
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment