Let it Snow in the Terminal of Mac OS X with This Command
Tis the season for some winter fun and holiday magic… in your Mac OS X Terminal with some digital snow fall!
This nifty not-so-little ruby command string will make it snow in the command line of your Mac, there isn’t much to get it snowing beyond a simple copy and paste, but for best results be sure to be using a white-on-black Terminal theme like “Peppermint”, “IR Black”, “Pro”, or “Classic” to get white snow flakes, otherwise you’ll end up with some funky colored snowflakes that aren’t exactly festive…
How to Make Terminal Snow
Ready for the snow? Here’s what you’ll want to do:
- Launch Terminal app, found in the /Applications/Utilities/ directory
- Set the active Terminal window to a white-on-black theme by hitting Command+i from the Terminal window to change the visual settings instantly using the Inspector panel
- Copy and paste the following command string into the prompt:
- Hit the Return key to start the snow fall
ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'
Make sure the the entire command string is all on a single line, it should look something like this when pasted at the prompt before hitting enter to start running:
Once you hit return you’ll immediately see the snowflakes falling, it’s better represented by the animation up top but this screen shot gives a static example. The snowflakes will continuously fall, and accumulate on a single line at the very bottom of the terminal window:
You can stop the fancy ruby snow machine by hitting Control+Z to suspend the process.
For the best wintery results, crank up the font size of the terminal window a by by hitting Command+ a few times, size 18 or larger is best to show off the snowflake details. Leaving your desk? Throw the Terminal window into Full Screen App Mode, and then execute the snow machine command for a nice little screen saver.
The command consumes about 4% to 10% CPU to run indefinitely in the background, which isn’t too aggressive but it’s enough that you probably won’t want to be running this process if you’re busy trying to conserve battery life or dedicate all your processing power to rendering something important.
Getting chilly just watching that virtual snow fall? Well it’s also the right time of year to bust our the classic 8 bit fireplace app and warm up by some pixelated virtual flames. Your Mac has never been so festive, has it?
Bah humbug? Not into the whole holiday cheer thing? Maybe you just hate the snow with a passion? That’s alright, because you can go with The Matrix for your command line instead, which looks pretty fancy pants and a lot less seasonal.
This nifty trick was found in the CLIMagic comments, and for command line users who aren’t running Mac OS X you’ll find another solution that works for linux too (the other command does work on the Mac too, but requires gawk to be installed beforehand through Homebrew or compiled yourself with gcc).
Thanks, You guys never let me down
I don’t know what I’m doing but I didn’t copy and paste the command properly, LOL!
It’s defective! The snow keeps melting… ;)