How To Play Games In the OS X Terminal

You can actually play simple games in your Mac's Terminal.

Jacob Lopez, Contributor

June 28, 2011

3 Min Read

BYTE -- Here's a fun geek trick in OS X. Within the Terminal on your Mac is something called emacs. It's a text editor tool found in most Unix-based systems. Hardcore geeks love it, and you can have some fun with it too. It's easier than you think.

To access the Terminal, go to: Applications>Utilities>Terminal


When the Terminal window pops up, type in the following command:emacs


Then hit Enter. You will see GNU emacs. There, you can see the version number (22.1, highlighted in the image below). Keep that in mind for later.


After that, press [ESC]X.


You'll be prompted to enter an M-x command. You can enter any of the commands shown below.

You can view this list by opening a new terminal window and typing in this command (note the space after “ls”): ls /usr/share/emacs/(version number)/lisp/play

So mine looks like this: ls /usr/share/emacs/22.1/lisp/play


In order to keep this fun, I’ve skipped stuff like Cookie1 since that dives deeper into emacs than needed right now. Let's jump right in and check out some of the games you can play in the Terminal.

5x5: Is similar to a blackout game. Move the cursor around the 5x5 grid and hit enter to fill in all the squares.


Animate: Make up a name (for kicks I went with Doug) and see a little animated birthday poem in which letters fly in to form the words.


Doctor: This one is a lot of fun. The computer tries to hold a conversation with you. It's not very good at it, but that makes it all the more enjoyable.


Gomoku: In this game you compete with the computer to place five characters (Xs and Os) in a row.


Hanoi: Watch emacs solve the old stacking puzzle-type game, Tower of Hanoi.


Life: This is just John Conway's cellular automation called Life. You don't do anything but watch the characters multiply until they all die off and all life ceases to exist. Other times, it can go on infinitely.


Pong: Ah, the father of all video games and a classic. The up and down arrow keys control the right paddle, and the up and down arrow keys control the left paddle. Not exactly a useful control scheme unless you have two keyboards or want to play pong against yourself. The good news is that you win either way. The bad news is, you also lose a lot.


Snake: Slither around eating the little dots. Your snake grows longer over time. Try not to crash into a wall or your own tail.


Tetris: Alexey Pajitnov's addictive creation and perhaps the most popular puzzle game of all time. The left and right arrows move shapes left and right, the up and down arrows rotate the shapes and the spacebar forces the shape to drop to the bottom of the screen.


Admittedly, these are just fun time-waters. But it's fun to run them in Terminal and sure as heck makes for a good geek party trick. There are many other games you can find in the Terminal too. Give them a try and see for yourself.

Based in McAllen, TX, Jacob Lopez is a senior editor at BYTE. Follow him @8bitjay and email him with news tips at [email protected] .

About the Author(s)

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like


More Insights