Piping colored output into Less

I’m trying to get the colored output from gradle to be displayed by less on Mac OS X. I’ve tried ‘gradle --console rich tasks | less -r’ (and also ‘gradle --console rich tasks | less -R’), but to no avail. I’m running Mac OS X 10.10.3, with Zsh as my shell.

Any suggestions would be greatly appreciated.


Roger Alexander.

1 Like

I see that is old topic but I faced the same problem and found the solution. Maybe it will be useful for someone.
One of the ways to do that is redirect stderr to stdout, like that:
gradle --console rich tasks 2>&1 |less -R

1 Like

gradle --console rich tasks 2>&1 | less -r
( -r is --raw-control-chars)
looks better - it skips 0% CONFIGURING outputs.