Install Oh‐My‐Zsh - lightblueseas/linuxstuff GitHub Wiki

Install Oh-My-Zsh

You can install Oh-My-Zsh using either curl or wget commands.


Prerequisites

  • Ensure you have Zsh installed. You can install it using:
    sudo apt-get install zsh
    
  • Change your default shell to Zsh:
    chsh -s $(which zsh)
    

1. Install Oh-My-Zsh via curl

Note: On Ubuntu, curl might not be installed by default. To install curl, run:

sudo apt-get install curl

Run the following command to install Oh-My-Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

2. Install Oh-My-Zsh via wget

Run the following command to install Oh-My-Zsh:

sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

3. Automated Installation Script

You can use the following script to install Zsh, curl or wget (if not already installed), and then install Oh-My-Zsh:

#!/bin/bash

# Install Zsh if not installed
if ! command -v zsh &> /dev/null; then
    echo "Zsh not found. Installing Zsh..."
    sudo apt-get install -y zsh
else
    echo "Zsh is already installed."
fi

# Install curl or wget if not installed
if command -v curl &> /dev/null; then
    echo "Using curl to install Oh-My-Zsh..."
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
elif command -v wget &> /dev/null; then
    echo "curl not found. Using wget to install Oh-My-Zsh..."
    sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
else
    echo "Neither curl nor wget is installed. Installing curl..."
    sudo apt-get install -y curl
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi

# Change default shell to Zsh
echo "Changing default shell to Zsh..."
chsh -s $(which zsh)

echo "Installation complete. Please restart your terminal."

Save this script as install-oh-my-zsh.sh and make it executable:

chmod +x install-oh-my-zsh.sh

Run the script:

./install-oh-my-zsh.sh

Additional Resources

For a detailed installation guide, visit the Oh-My-Zsh GitHub page.