How to View Images in the Terminal

A practical guide to open, chafa, iTerm2 imgcat, Kitty icat, and WezTerm imgcat.

Contents

  1. Quick takeaway
  2. Common commands
  3. Why chafa looks low resolution
  4. zsh: command not found: kitty
  5. imgcat prints nothing
  6. Which method to use

1. Quick takeaway

There are two different meanings of “show an image in the terminal”:

If you only want to open the image from a command line on macOS, use:

open "chart.png"

2. Common commands

iTerm2 imgcat

imgcat /path/to/image.png

# If the script is in the current directory
./imgcat "chart.png"

If imgcat is not installed, install iTerm2 Shell Integration or download the helper script:

curl -L https://iterm2.com/utilities/imgcat -o /usr/local/bin/imgcat
chmod +x /usr/local/bin/imgcat

Kitty icat

kitty +kitten icat /path/to/image.png

WezTerm imgcat

wezterm imgcat /path/to/image.png

Generic preview chafa

brew install chafa
chafa /path/to/image.png

3. Why chafa looks low resolution

This usually does not mean the image is broken. It is a limitation of how character previews work.

These options can improve the result:

chafa --size=120x60 image.png
chafa --symbols=block --size=120x60 image.png
chafa --colors=full --size=120x60 image.png
chafa --format=symbols --symbols=space --fill=block --colors=full image.png

The biggest improvements usually come from enlarging the terminal window, reducing the font size, and using a truecolor terminal. For high-resolution inline images, use imgcat, kitty +kitten icat, or wezterm imgcat instead.

4. zsh: command not found: kitty

kitty is not a built-in macOS command. It is a terminal emulator. This error means Kitty is not installed, or its executable is not in your PATH.

Install it on macOS with:

brew install --cask kitty

Then open the Kitty terminal and run:

kitty +kitten icat image.png

If you do not want to switch terminals, use the method for your current terminal: imgcat in iTerm2, wezterm imgcat in WezTerm, or open/chafa in a regular terminal.

5. imgcat prints nothing

If ./imgcat "chart.png" appears to do nothing, the most common cause is that your current terminal does not support iTerm2's image protocol.

Check the terminal first:

echo $TERM_PROGRAM

If the output is not iTerm.app, for example Apple_Terminal, vscode, or WarpTerminal, imgcat may not render an image.

Then verify the script and image file:

ls -l ./imgcat "chart.png"
file "chart.png"

# If imgcat is not executable
chmod +x ./imgcat

You can also check whether the script itself prints help:

./imgcat --help

If help output appears but the image does not render, the terminal image protocol is the likely issue. Open iTerm2, go to the image directory, and run ./imgcat "chart.png" there.

6. Which method to use

Use caseCommandNotes
Open the image externallyopen image.pngUses the system image viewer instead of rendering inline.
Rough preview in a regular terminalchafa --colors=full --size=160x80 image.pngPortable, but detail is limited.
Inline display in iTerm2imgcat image.pngRun it inside iTerm2.
Inline display in Kittykitty +kitten icat image.pngRequires Kitty.
Inline display in WezTermwezterm imgcat image.pngRequires WezTerm.