rodruizronald / mac-dracula-terminal

Short guide to setup a colourful iterm2 terminal using Dracula theme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Are you a Dracula Theme lover? I got you! Have a look at the end result.

alt

alt

alt

alt

This guide goes straight into the commands for tool installation. For those seeking more in-depth insights, I've included direct links to the original websites.

Since macOS Catalina (10.15.2) the default shell is now Zsh instead of Bash; therefore, this guide assumes you are using Zsh already.

Homebrew it's a command line tool used for installing apps. It will be needed later for the installation of other tools.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

To enable it, run the following command on the terminal.

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

Apply changes to your system.

source ~/.zprofile

iTerm2 is a replacement for Terminal, the default terminal that comes installed on Macs.

brew install --cask iterm2

One of my favourite themes for iTerm2.

Clone the repository or download it manually using the GitHub .zip download option.

git clone https://github.com/dracula/iterm.git

Then follow the steps below:

  • iTerm2 > Preferences > Profiles > Colors Tab

  • Open the Color Presets... drop-down in the bottom right corner

  • Select Import... from the list

  • Select the Dracula.itermcolors file

  • Select the Dracula from Color Presets...

Oh-My-Zsh is a framework for managing your Zsh configuration. It will boost your productivity with nice plugins and make your terminal look pretty.

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

Homebrew installs GNU coreutils with a 'g' prefix. The dircolors, or in this case, gdircolors are used to set up the colours applied to the ls command.

brew install coreutils

Clone the repository or download it manually using the GitHub .zip download option.

git clone https://github.com/seebi/dircolors-solarized.git

Create a config directory for dircolors and move the dircolors.ansi-dark.

mkdir -p ~/.config/dircolors
cp dircolors-solarized/dircolors.ansi-dark ~/.config/dircolors

Use the dircolors.ansi-dark color format on gdircolors and override ls command to use gls instead.

echo 'eval "$(gdircolors ~/.config/dircolors/dircolors.ansi-dark)"' >> ~/.zshrc
echo 'alias ls="gls --color=auto --group-directories-first"' >> ~/.zshrc

Oh-My-Zsh seems to change the colours for auto-completion. Add the following lines to the ~/.zshrc file.

echo 'zstyle ":completion:*" list-colors "${(@s.:.)LS_COLORS}"' >> ~/.zshrc 
echo 'autoload -Uz compinit' >> ~/.zshrc
echo 'compinit' >> ~/.zshrc

Apply changes to your system.

source ~/.zshrc

Powerlevel10k is a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Then set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc, and start a new terminal session.

It suggests commands as you type based on history and completions.

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Then add the plugin to the list of plugins inside ~/.zshrc, and start a new terminal session.

plugins=( 
    # other plugins...
    zsh-autosuggestions
)

It provides syntax highlighting, red for invalid and green for valid commands.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Then add the plugin to the list of plugins inside ~/.zshrc, and start a new terminal session.

plugins=( 
    # other plugins...
    zsh-syntax-highlighting
)

9. Tree

It lists the content of directories in a tree-like format.

brew install tree

A Ruby script that colourizes the ls output with colour and icons. First install a version manager tool for Ruby with:

brew install rbenv ruby-build

Then to load rbenv automatically, append the following to ~/.zprofile, and start a new terminal session.

echo 'eval "$(rbenv init - zsh)"' >> ~/.zprofile

Apply changes to your system.

source ~/.zprofile

Install Ruby 3.0.6, but feel free to install any other as long as version >= 2.6.

rbenv install 3.0.6

Set Ruby 3.0.6 as global to be used in all shells with:

rbenv global 3.0.6

Install the colorls ruby gem with:

gem install colorls

Note: colorls doesn't obey the ls output color format, instead, it uses a fixed theme. The next step will fix it.

Clone the repository or download it manually using the GitHub .zip download option.

git clone https://github.com/dracula/colorls.git

Copy the dark_colors.yaml file to the dark colour scheme location for colorls.

mkdir -p ~/.config/dircolors
cp colorls/dark_colors.yaml ~/.config/colorls

Finally, add some aliases in ~/.zprofile

  • lc shows the file view with directories first, followed by files.

  • tc shows a tree view with directories first, followed by files.

echo 'alias lc="colorls --sd --dark"' >> ~/.zprofile
echo 'alias tc="colorls --tree --sd --dark"' >> ~/.zprofile

Apply changes to your system.

source ~/.zprofile

About

Short guide to setup a colourful iterm2 terminal using Dracula theme.

License:MIT License