How to Play Tetris, Pong and Other Hidden Games on Your Mac

How to Play Tetris, Pong and Other Hidden Games on Your Mac

Tutorial Details
  • Topics: Terminal, Gaming
  • Difficulty: Intermediate
  • Estimated Completion Time: 15 Minutes
This entry is part 4 of 10 in the Taming The Terminal Session
« PreviousNext »

Did you know that you can play Tetris on your Mac? Of course you did, you can play lots of games. But did you know that there’s already a Tetris game built in? In fact, if you know your way around Emacs, you can play a whole bunch of awesome retro games like pong and snake. Read on to see how.


Are There Really Hidden Games on My Mac?

Yep. Tucked deep into the recesses of your Mac’s darkest corners, there’s a whole list of delightfully retro applications specifically written for a text editor called Emacs. In this tutorial, I’ll walk you through the step by step process of getting to the screen where you launch the games and show you the hidden directory where you can see a list of your options.


Step 1: Open Terminal

The first thing that you need to do is open Terminal, which is located inside of the “Utilities” folder inside of your “Applications” folder.

Finder
Terminal is located inside of your Utilities folder

I know this is scary, but don’t worry. You don’t need to be a Terminal wizard to follow this tutorial. Even if it’s your first time opening Terminal, you’ll be just fine.

That being said, always take caution when opening Terminal. Never type in anything if you aren’t exactly sure what’s going to happen. This app has a crazy amount of control over how your Mac operates and you can seriously screw stuff up if you’re not careful.


Step 2: Launch Emacs

Once you’re inside of Terminal, you’ll need to enable Emacs. No, I’m not talking about the big white Macs that Apple used to sell, it’s a special text editor that’s built on the concept of extensibility.

It’s all super technical, and you can read about it here, but for now all you need to know is that you need to enter in this command and hit Return:

emacs

That’s it! You just entered a command into Terminal. That wasn’t so bad, was it?

Terminal
Type “emacs” and hit Return

Step 3: Launch Tetris

Once you’ve successfully enabled Emacs, your Terminal window will fill up with all kinds of crazy stuff. It should look something like this:

Terminal
GNU Emacs in Terminal

Once you see this, hit the Escape key. This should bring up the screen shown below.

Terminal
Hitting Escape should bring up this screen

After you release the Escape key and see the screen above, hit the “x” key. This should bring up a “M-x” prompt at the bottom left of the screen. To launch the Tetris game, simply type “tetris” here and hit Return.

Terminal
After you release the Escape button, hit “x”, then type “tetris”

That’s it! This should launch the Tetris game. Now let’s take a look at how to play.


How to Play

The Tetris game here will probably be one of the most basic, bare bones Tetris clones that you will ever play. This thing is super hidden, ugly and difficult to play. When the free online Tetris games are so good, the only real reason to play this one is to chalk up some hardcore nerd points.

Terminal
Tetris in Terminal

If you’re like me though, that’s more than enough of a reason to bust this out from time to time. As you can see, the playable area is oddly narrow. The score and next block are shown to the right of the main area.

As blocks (aka Tetriminos) fall, use the arrow keys to push them around. To spin a block, use the up key. To instantly drop a block, hit space.


More Games

As it turns out, there are quite a few games that can be accessed using the exact same method described above. Follow the same steps, only when you get to the part where you typed in “tetris” try a few other things like “pong” or “snake”.

Terminal
Pong in Terminal. One player uses the 4 and 6 keys, the other uses the arrows keys.
Terminal
Snake in Terminal

To see the directory of games that are available for you to play, go to Finder, hit Command-Shift-G and type in the following:

/usr/share/emacs/22.1/lisp/play

This should bring you to a folder that shows a bunch of different games. Try entering the various names seen here into the M-x prompt from before.

Terminal
Emacs Games can be found in /usr/share/emacs/22.1/lisp/play

To get you started, here are some game names that I know work:

  • tetris
  • pong
  • snake
  • solitaire (Not what you think)
  • gomoku (sort of like Connect 4)
  • 5×5
  • dunnet (text based adventure game)
  • landmark
  • doctor

To be honest, several of the games that I came across were just plain confusing. You’re launched into a bizarre screen and forced to figure out what’s going on. Others are not so much games as animation examples or simulations. For instance, try typing in “doctor” and you’ll find yourself in a frustrating conversation with a quirky electronic psychotherapist!

Terminal
The Doctor game is a simulated psychotherapist

Which Game is Your Favorite?

I’d wager that most Mac users have no idea that these games are hidden away on their computer. The Mac OS has been around for so long that there’s a lot to discover if you know where to look.

Now that you know about these hidden gems, you simply have to go try them. Follow the instructions above, then report back here to let us know which game you liked best.

Josh Johnson is secondfret on Graphicriver
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Nick Pavlovits

    Oh yes, I used to do this a while back, lots of fun! great tutorial!

  • http://customct.com/ Richard Guay

    Blackbox is still my favorite.

  • Matt

    how do you get back to the regular command prompt line in terminal once your finished playing this games?

    • http://customct.com/ Richard Guay

      Hi Matt,

      Just exit emacs (ctl-x, ctl-c). Or, switch your buffer to do more editing and go back to the game later (ctl-x,ctl-b). Or, run the graphical version of emacs which you can download as well (AquaEmacs).

  • Tuuli

    We had a game similiar to “Doctor” in my elementary school’s computers! Brings up good memories…

  • Joe

    This illustrates one of the things about my Mac that I don’t like. Why is it that I have to stumble across articles about hidden features that are difficult to access (no point and click)? I have had a Mac for years and did not know this. My PC had a folder called “games”. Is that too pedestrian for Apple?

    • Joesgay

      These games are not intended for the “point and click” crowd. There are plenty of free games in the App store that i’m sure you’d enjoy a lot more than these.

    • http://urial.in/ Nik Matt

      This isn’t a hidden feature of OS X, this is a well-known feature of emacs that most people never encounter because most people will never use emacs.

      • facfix

        Exactly. These are part of emacs. If you launch emacs on version of linux you will find the same thing.

  • Katherine Riedel

    It’s nice to know this exists, it takes me back to my days with Windows 3.0 and QBasic… The commands are similar too.
    The solitaire game is a game you play with rocks or marbles, my husband has a set he got in Madagascar, I don’t know what it’s called though. The object of the game is to have one marble left on the board, and you hop over marbles like in chinese checkers. It’s actually pretty fun if you’re bored. However, Dunnet is my favorite game so far, text based RPG’s are awesome.

  • http://www.facebook.com/suvo.me আমি কেউ নাহ

    woo… cool :D

  • http://twitter.com/farid9898 Farid Ahmad

    Great tutorial. BTW, if anyone is looking to play the Classic Snake game on the mac, please also try : http://www.jumpstartideas.com/mac/snake/