Let it Snow in the Terminal of Mac OS X with This Command

Dec 6, 2013 - 2 Comments

Make it Snow in the Terminal with a command

Tis the season for some winter fun and holiday magic… in your 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…

Ready for the snow? Here’s what you’ll want to do:

  1. Launch Terminal app, found in the /Applications/Utilities/ directory
  2. 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
  3. Copy and paste the following command string into the prompt:
  4. 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}'

  5. Hit the Return key to start the snow fall

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:

The snow command

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:

Snow in the command line

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 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).

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Fun, Mac OS X, Tips & Tricks

2 Comments

» Comments RSS Feed

  1. vdiv says:

    It’s defective! The snow keeps melting… ;)

  2. Daire Crozier says:

    I don’t know what I’m doing but I didn’t copy and paste the command properly, LOL!

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates