iTerm2

Here's a step-by-step guide to help you set up a nice iTerm2 configuration on your Mac. This setup will focus on aesthetics, productivity, and usability. We’ll cover installing iTerm2, customizing its appearance, adding features, and using some popular tools to enhance your terminal experience.

Step 1: Install iTerm2

  1. Download iTerm2:

  2. Install iTerm2:

    • Open the downloaded file and drag the iTerm2 app to your Applications folder.

Step 2: Basic iTerm2 Configuration

  1. Launch iTerm2:

    • Open iTerm2 from your Applications folder.

  2. Set iTerm2 as Default Terminal:

    • Go to iTerm2 > Make iTerm2 Default Term in the menu bar.

  3. Check for Updates:

    • Go to iTerm2 > Check for Updates to ensure you have the latest version.

Step 3: Customize Appearance

  1. Install Powerline Fonts:

    • Open a new terminal window in iTerm2 and run the following command to clone the Powerline fonts repository:

      git clone https://github.com/powerline/fonts.git --depth=1
    • Navigate to the cloned directory and run the installation script:

      cd fonts
      ./install.sh
    • After installation, you can remove the cloned repository:

      cd ..
      rm -rf fonts
  2. Choose a Color Scheme:

    • iTerm2 supports custom color schemes. You can download schemes from iTerm2 Color Schemes.

    • To import a color scheme, go to iTerm2 > Preferences > Profiles > Colors tab, and click Color Presets > Import. Select the downloaded .itermcolors file.

  3. Set a Font:

    • Go to iTerm2 > Preferences > Profiles > Text.

    • Choose a Powerline-compatible font like "MesloLGS NF" from the dropdown.

  4. Transparency and Blur:

    • Go to iTerm2 > Preferences > Profiles > Window.

    • Adjust the transparency slider and enable blur for a nice effect.

Step 4: Enhance Functionality

  1. Install Oh My Zsh:

    • Install Zsh if you haven’t already by running:

      brew install zsh
    • Then install Oh My Zsh using the following command:

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

    • Oh My Zsh comes with many themes. You can set a theme by editing the ~/.zshrc file:

      nano ~/.zshrc
    • Find the line ZSH_THEME="robbyrussell" and change it to your desired theme, e.g., agnoster for a Powerline-like theme:

      ZSH_THEME="agnoster"
  3. Install Zsh Plugins:

    • zsh-syntax-highlighting: Highlights command syntax.

      brew install zsh-syntax-highlighting

      Add the following to your .zshrc:

      source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    • zsh-autosuggestions: Suggests commands as you type.

      brew install zsh-autosuggestions

      Add the following to your .zshrc:

      source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
  4. Configure Plugins in Zsh:

    • Edit your .zshrc file to include plugins:

      plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
  5. Reload Zsh Configuration:

    • After making changes, reload your terminal configuration:

      source ~/.zshrc

Step 5: Use Tmux for Multiplexing

  1. Install Tmux:

    • Install Tmux via Homebrew:

      brew install tmux
  2. Configure Tmux:

    • Create a configuration file:

      touch ~/.tmux.conf
    • Add some basic configurations:

      # Increase history size
      set -g history-limit 10000
      
      # Enable mouse mode
      set -g mouse on
      
      # Set prefix to Ctrl-a
      unbind C-b
      set-option -g prefix C-a
      bind-key C-a send-prefix
  3. Use Tmux:

    • Start a new Tmux session:

      tmux
    • Detach from the session with Ctrl-a d.

    • Reattach with:

      tmux attach-session -t <session-name>

Step 6: Additional Tips

  • Hotkeys:

    • Go to iTerm2 > Preferences > Keys to configure key mappings for easier navigation.

  • Window Management:

    • Use Cmd-d to split panes vertically and Cmd-Shift-d to split horizontally.

  • Profile Switching:

    • Create multiple profiles for different tasks, accessible from iTerm2 > Preferences > Profiles.

  • Automation and Scripting:

    • Explore iTerm2’s scripting capabilities to automate tasks using Python or AppleScript.

Last updated