Get a Rainbow of Colors for Terminal Command Output with lolcat
The Terminal defaults to being a bunch of boring black on white text, and sure you can change the appearance to other themes, add colors, background images, opacity, transparencies, and other UI customizations, but what you really want is obviously a rainbow version of the cat command for input and output, right? Right, of course you want rainbow output, who wouldn’t want that?
That’s where the lolcat command line utility comes in, because lolcat is a concatenate utility that can serve as a very colorful cat replacement, or take any standard input and dump the output as a rainbow of text. Is this useful? Well, that’s up to you to decide, but it sure is fun and more lively looking.
Note: in case it wasn’t obvious yet, this is kind of a joke, but lolcat legitimately does work as a functioning cat replacement. Because this is entirely contained within the command line, it’s best reserved for advanced users who are comfortable using Terminal… and who want rainbow output.
Installing lolcat in the Mac OS X Terminal
You’ll need to have ruby installed on the Mac to be able to use gem, the installer, and then installing lolcat is a piece of cake:
gem install lolcat
That should install lolcat just fine, but if you get a write permissions error like this:
“ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.”
You can either adjust the permissions of the gems directory to include your uid, or just use sudo to write to it anyway:
sudo gem install lolcat
Installing should only take a minute or two to complete.
Uisng lolcat to Make Output a Rainbow
With installation of lolcat out of the way, you’re ready to use lolcat and get colorful. Refresh your terminal or launch a new one and you’re ready to go. You can get an initial look by printing the lolcat help file:
You’ll then see the most colorful help text ever made.
But why stop there? You can pipe anything into lolcat and make it a rainbow as well:
ps aux|grep root|lolcat
Or use lolcat to display some code in a lovely rainbow:
If you want some extra amazement, the -a flag is particularly exciting because it creates an animated rainbow effect of cycling colors, which is basically the peak of human innovation.
For example, this will animate the Apple logo in a rainbow for a count of 500:
echo |lolcat -a -d 500
Want a colorful block of ascii art? Use cowsay or banner:
The possibilities are endless.
The lolcat utility is open source, those interested can view the project page on github.