Terminal: Installing Ranger and Setting Image Viewer on Kitty ver. 7

Last Updated on September 23, 2022 by shibatau

VI is added.

I. What is Ranger?

It reads at https://github.com/ranger/ranger:

ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with rifle, a file launcher that is good at automatically finding out which program to use for what file type.

Image by Author

II. How to install Ranger

1.Run the following command in the terminal.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2> /dev/null

2.Run the following command in the terminal. You have to install Homerew beforehand.

brew install ranger

You can learn more here:

Install ranger on Mac OSX

III. Enable Image Preview in Ranger

1.Create a rc.conf file

cd ~/.config/ranger && touch rc.conf

Open the rc.conf file with Nvim (or your favorite editor):

nvim rc.conf

Add the following two lines to the rc.conf file:

set preview_images true
set preview_images_method kitty

Install the Pillow library using Pip

pip install Pillow

Open ranger with the following command in the terminal.


IV. How to use Ranger

You can learn how to use from here:

Ranger on Linux – A Complete Terminal File Manager For Linux

You can execute shell commands from the terminal with : For example, you can delete files with trash-cli with :shell trash-put file_name1 file_name2 if you have installed it.

V. If Preview doesn’t work

1. Replace the path with the correct path to the Python used with Ranger in ranger.py as suggested in the post:

How to enable image preview on Ranger using Kitty

2.Set ranger.py via ranger

This has worked for me. You can enter Command Mode with : in Ranger in the same way as Vim editor.

  1. Run ranger --clean  in the terminal
  2. Ran :set preview_images true in Ranger
  3. Ran :set preview_images_method kitty in Ranger

VI. If Ranger freezes on particular files on Mac

I have delete ranger installed via Homebrew and install it with Pip:

pip install ranger-fm

But Ranger freeze when hovering certain files as before and even Ctrl+c doesn’t work at all.

You can avoid freezing if you take time enough to show texts or a image when you move from a file to another one.

Probably you can fix this by changing scope.sh. I use miniconda on Mac and the scope.sh and the file is located in /Users/MYNAME/opt/miniconda3/lib/python3.9/site-packages/ranger/data. I have not changed anything yet. If you want, you can get some information on that here:


About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.