Scrolling doesn't work in Terminal for commands like less I used to be able to scroll using the trackpad through git diff or man pages which both use less when the output doesn't fit on screen. Today I restarted my computer and that behaviour is gone and I can no longer scroll down and if I scroll up it scrolls the terminal scrollbar showing previous commands. However in vim scrolling still works as expected.

The first thing I checked is the "Scroll alternate screen" Terminal setting and it is checked as expected. I also tried with iTerm2 and have the same issue even with the "Scroll wheel sends arrow keys when in alternate screen mode" setting enabled.

My default shell is zsh so I tried with bash and then sh. Both have the same behaviour and I can't scroll through the output.

Because scrolling still works with some commands like vim it seems like the issue might be that less is no longer recognized as an "alternate screen" but I have no idea why. Updating to the latest less version available on brew did not help.
it is weird, I had the exact issue this morning with iterm2.

I ended up adding the following to my ~/.zshrc:

export LESS=-R


Important: you might want to take a look at the flags you are using before running this command and understanding what each of them do.

Sources I looked at to arrive to this conclusion:


https://askubuntu.com/questions/803486/can-i-scroll-to-new-lines-using-mouse-wheel-inside-git-diff
https://superuser.com/questions/455212/how-to-make-mouse-wheel-scroll-the-less-pager-using-bash-and-gnome-terminal


Let me know if this helped.