How to enable image preview on Ranger using Kitty
First, create a config file for Ranger in
cd ~/.config/ranger && touch rc.config
Open the config file and add the following lines to it:
set preview_images true set preview_images_method kitty
Install the Pillow library using
pip (Python’s package installer)
pip install Pillow
The image preview feature should be working now. If you’re getting an error, try following the steps below.
ERROR: Image previews in kitty require PIL (pillow)
First, check where Python is located on your computer using the
You should see something other than
/usr/bin/python and that’s probably the reason why you are getting this error.
In my case, I installed Python through ASDF. So I get the following output when I run
You should copy this path.
Now go to where Ranger is installed. If you installed it via Homebrew, you should go to
/usr/local/Cellar/ranger/1.9.3/libexec where 1.9.3 is the version of Ranger that you have installed.
ranger.py with Vim or any other text editor and replace this line:
with the path to where Python is located. In my case it was:
Now, save the file and everything should be working.