Setup best terminal for mac

  • August 26, 2023
  • 196

Tăng hiệu suất làm việc khi thiết lập terminal cực kì ngầu theo cách sau. Để cài đặt các ứng dụng cho Mac dễ dàng chúng ta sẽ install brew for mac trước.

Install brew

cài đặt brew cho mac giúp cài đặt mọi ứng dụng cực kì dễ dàng


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

// Check version
brew -v

Install Iterm2

Mặc định terminal của mac rất hạn chế nên chúng ta sẽ sử dụng Item2. Cài đặt Iterm2 với brew


brew install --cask iterm2

Install Oh My Zsh

Cài đặt Oh My Zsh giúp termial trở lên cực kì mạnh mẽ.


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

Install zsh theme powerlevel10k

Cài đặt zsh theme powerlevel10k giúp giao diện terminal cực kì ngầu và cũng rất dễ tuỳ chỉnh sau này. Theme powerlevel10k yêu cầu chúng ta cần cài MesloLGS Fonts cho mac


MesloLGS NF Regular.ttf
MesloLGS NF Bold.ttf
MesloLGS NF Italic.ttf
MesloLGS NF Bold Italic.ttf

Cài đặt theme powerlevel10k với Oh My Zsh


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

Set theme powerlevel10k trong zshrc, mở file ~/.zshrc với vi tìm đến zsh_theme rồi sửa lại tên theme.


ZSH_THEME="powerlevel10k/powerlevel10k"

Install zsh-syntax-highlighting plugin

Cài đặt zsh-syntax-highlighting plugin giúp higlighting các syntax khi gõ lệnh.


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

// Active plugin in ~/.zshrc
plugins=(
  git
  zsh-syntax-highlighting
)

Install zsh-autosuggestions plugin

Cài đặt zsh-autosuggestions plugin giúp suggest các command hay dùng.


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

// Active plugin in ~/.zshrc
plugins=(
  git
  zsh-syntax-highlighting
)

Tắt terminal sau đó thiết lập giao diện terminal với command


p10k configure

giờ chúng ta sẽ chọn giao diện mà mình thích, sau đó export ZSH


source ~/.bash_profile

Đây là theme mình chọn sau khi thiết lập xong.
zsh terminal

Tổng kết

Như vậy là chúng ta đã thiết lập xong terminal cực kì mạnh mẽ cho mac rồi nhé. Thanks for reading....