Skip to content

Instantly share code, notes, and snippets.

@r4vr4n
Last active November 22, 2024 06:15
Show Gist options
  • Select an option

  • Save r4vr4n/b6586fe7fcd54e67bec117e2d352a7f4 to your computer and use it in GitHub Desktop.

Select an option

Save r4vr4n/b6586fe7fcd54e67bec117e2d352a7f4 to your computer and use it in GitHub Desktop.
setup-my-terminal-unattended
# Elevate privileges and keep sudo active
sudo -v && \
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & \
# Install required packages: git, zsh, and curl (non-interactive)
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y git zsh curl && \
# Install Oh My Zsh without user prompts
yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
# Install Homebrew non-interactively (accepting defaults)
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
# Add Homebrew to PATH by adding it to .zshrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc && \
# Initialize Homebrew in current session
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
# Install build-essential package non-interactively
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential && \
# Install gcc through Homebrew without prompts
HOMEBREW_NO_AUTO_UPDATE=1 brew install gcc pnpm yarn && \
# Install zsh-autosuggestions plugin
git clone --quiet https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
# Install zsh-syntax-highlighting plugin
git clone --quiet https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \
# Install nvm without prompts
PROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash' && \
# Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ # This loads nvm
# Install tmux, neovim, and GitHub CLI without prompts
HOMEBREW_NO_AUTO_UPDATE=1 brew install tmux neovim gh && \
# Automatically update .zshrc to enable plugins
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc && \
# Print completion message
echo "Installation completed successfully!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment