I got tired of less on my mac being less colorful than on gentoo:

Colorful less output of a C file

After some mucking around with equery to figure out what’s going on, here’s what you can do.

Console Setup

sudo port install less
curl "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/sys-apps/less/files/lesspipe.sh" > lesspipe.sh
curl http://www-zeuthen.desy.de/~friebel/unix/less/code2color > code2color
sudo cp code2color lesspipe.sh /opt/local/bin/

Note that we’re pulling code2color from its author’s website, and grabbing lesspipe.sh from the gentoo rsync source. If you don’t want to pull them from the web, you can also grab these from your local gentoo box.

Environment variables

export LESS="-R -M --shift 5"                               
export LESSOPEN="|lesspipe.sh %s"

Instructions

We have the files in the right spot now, all that’s needed is to take the right environment variables put them in your shell’s environment. Check the manpage for your shell, but if you want it to be there for everybody try /etc/profile or /etc/zprofile; if you want to hoard it use ~/.zshenv or ~/.bash_profile .

Future work

All I have to do now is modify lesspipe.sh so it calls otool for Mac binaries, but I have to figure out a good argument set first.