Add Syntax Highlighting in Zsh Shell

To add Syntax Highlighting in Zsh Shell, follow the below steps,

  1. Open the Terminal on your Mac/Linux.
  2. Make sure you have brew installed.
    % brew --version
    Homebrew 4.0.19
  3. Now you will need to install package zsh-syntax-highlighting using HomeBrew.
    % brew install zsh-syntax-highlighting
  4. Make sure to edit the .zshrc file and add the following.
    source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  5. Run the below command to activate syntax highlighting.
    % source ~/.zshrc

Now when you will try to run commands with options on your Zsh shell you will see the text getting syntax highlighted (blue and red).

Syntax Highlighting in ZSH Shell

If you face any problems in these steps, do let me know in the comments, I will try to assist.


Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap