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 Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

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