Compiling MOO on Mac OS X
Despite many years of non-support, MOO remains the only MUD/MUSH I’m willing to use. Its “object-oriented” object creation is second to none that I have seen in a virtual world. The LambdaMOO code still compiles on OS X, although it takes some work.
This is based on MOO 1.8.1.
If you want to compile MOO on your system, you will need to have the developer’s tools installed, and be comfortable editing C .h files.
First, acquire the source code
- curl -LO 'http://prdownloads.sourceforge.net/lambdamoo/LambdaMOO-1.8.1.tar.gz'
- gunzip LambdaMOO-1.8.1.tar.gz
- tar -xvf LambdaMOO-1.8.1.tar
- cd MOO-1.8.1
Then, make the changes
All you need to do is comment out the inappropriate lines in some header files. Comment them out by adding two slashes ('//') at the beginning of the line.
- my-string.h: comment out memset on lines 28 and 83
-
my-socket.h:
- comment out setsockopt on line 32
- comment out bind in on line 37
- comment out connect on line 39
-
my-signal.h:
- comment out sigemptyset on line 34
- comment out sigaddset on line 35
- comment out sigprocmask on line 39
- my-ioctl.h: comment out ioctl on line 23
- my-sys-time.h: comment out setitimer on line 33
-
regexpr.h:
- comment out re_comp on line 105
- comment out re_exec on line 110
- utils.h and db_io.c: add “#include "string.h"” to the list of #includes.
Outbound Network Connections
If you want to enable outbound network connections (that is, if you plan on programming MOO objects that access Internet protocols), you need to uncomment line 158 of options.h.
Compile the result
Depending on the version of GCC you are using, you might get a lot of warnings when you compile MOO, including one with the word “panic” in it that looks serious. You should still get a successful compile, however. With GCC 3.3 and 4.0.1 I don’t get any warnings except a “comparison is always false” warning in execute.c and a few sign warnings in net_bsd_tcp.
- ./configure
- make
- sudo mkdir -p /usr/local/sbin
- sudo mv moo /usr/local/sbin
You can test the result on the provided test world, Minimal.db:
- /usr/local/sbin/moo Minimal.db Minimal.1.db
- open a new terminal window
- telnet localhost 7777
You should see the message that you’ve connected on your original terminal window, and see the minimal db on your new terminal window. Without being an expert in MOO, you can’t really do much there, so just CTRL-C in your original terminal window to terminate the MOO process.
Finally, you need to acquire a world
The most famous such world is LambdaMOO.
- curl -LO 'http://moo.kcc.hawaii.edu/~moo/MOO/documentation/LambdaCore-latest.db.gz'
- gunzip LambdaCore-latest.db.gz
- /usr/local/sbin/moo LambdaCore-latest.db LambdaCore.1.db
- open a new terminal window
- telnet localhost 7777
- connect wizard
- @password SOMEPASSWORD
It is important to change your wizard password immediately. Otherwise, anyone can log in as the wizard and do anything to your world.
Running a MOO Server
You can do all of this from the GUI, except running the program. First, make a folder where you can store your MOO database, and, if you use the File Utilities Package, create your ‘files’ and your ‘bin’ folders. (They need to be named exactly that, in all lower case.) Place your world database (most likely the basic LambdaCore) in that directory. Name it something simple and cool, like “WestWorld.db” or “PuppetLand.db”. Unless you are familiar with Unix, try to keep spaces out of the filename, and out of the folder name that you create (I suggest “MOO” in the root level of your home directory, in your system’s Library folder, or in the root level of a second volume).
Once you have your MOO folder set up, it is time to start up the server. We’ve been starting it up and watching the output on the terminal window, but usually you will want to be able to log out without forcing your MOO users off-line. So, go to a terminal window and ‘cd’ into your new MOO directory. Then (replacing MOOWorld.db with your world’s filename), type:
- nohup /usr/local/sbin/moo MOOWorld.db MOOWorld.1.db >& MOOWorld.log&
The “nohup” tells the Mac not to quit this program when you leave the terminal. The ‘>’ tells Unix to send both normal output and errors to the fille “MOOWorld.log”. The final ampersand tells your Macintosh to let this program run on its own. It will keep running even if you log out, as long as you do not shut down or restart your computer. Before shutting down or restarting your computer, you should log in to your world and type:
- @shutdown in 5 for restart
This will cleanly shutdown your world in five minutes (giving your users time to finish what they are doing), saving any changes that have occurred since the MOO started up. The next time you start up, you will want to start from the newly saved world file. In the above example, your newly saved world file will be MOOWorld.1.db, not MOOWorld.db:
- nohup /usr/local/sbin/moo MOOWorld.1.db MOOWorld.2.db >& MOOWorld.1.log&
Note that we changed the first world name to the second one on the previous line; the second world name to .2, and we are writing to a new log file. You will want to keep doing this; every time you restart your computer, use the latest copy of the world, and create a new log file for that version of your world.
If your world files start taking up too much space, you can go ahead and throw out your older ones, but always keep backups in case you need to “back up” to a previous version for any reason.
You can look at your log file with a program like “Smultron” or with the Unix “more” command. If your system is set up normally, double-clicking a file ending in “.log” will bring up the console viewer to view the log. The console viewer will show changes to the log as they happen even while it is in the background.
Regular Backups
By default, your MOO world will probably back itself up every hour, and when you shutdown cleanly. Note, however, that it backs itself up to the same file every time. One of the first things you should do after you start up your world and log in as your wizard is to check and set a regular backup time, and then make backups of your backup.
You don’t want to back up too often, because backing up blocks people from doing anything. But you need to back up often enough that you lose as little as possible in case of a power outage or some idiot unplugging your computer.
You can see what your current backup interval is by logging in as wizard and typing “@show #0.dump_interval”. If it is greater than 59, that is the number of seconds between dumps. If it is less than 60, the server will ignore that number and dump every hour. Experiment with that number if an hour seems too often or not often enough to you. Even if you decide to leave it at an hour (I do), I recommend explicitly setting the dump interval to an hour rather than just leave it at 0, just to keep things clear:
- ;#0.dump_interval=3600;
You will also want to do regular backups of your backup files. Especially now with OS X, your MOO might go for months without getting shut down. A single mistake by a wizard could do major damage—and if your MOO checkpoints right after the mistake, you have no way to restore your world except by going back to the version from a few months past. Set up a simple cron job or launchd job (using crontab -e or using a nice GUI like Lingon) to keep a couple of backups of your backup. How often you do this will depend on your world’s activity level, but I recommend keeping both recent and old backups. If recent means a day, also keep a backup for previous weeks. If recent means an hour, keep backups from the past few days. And store your backups on a different hard drive, if not a different computer altogether!
File security
You should create a non-admin user for your MOO if you install the File Utilities Package, as they allow access to the file system and access to programs.
- LambdaMOO
- “LambdaMOO is a network-accessible, multi-user, programmable, interactive system well-suited to the construction of text-based adventure games, conferencing systems, and other collaborative software.”
- MOO Stuff
- Text archive of MOO stuff, mostly some old objects. I’m still quite proud of the Christmas tree, originally written for Freegate on the old Illuminati Online.
- Apple Developer Tools
- “Mac OS X provides you with a full suite of free developer tools to prototype, compile, debug, and optimize your applications, speeding up your development cycle. Xcode, Apple’s integrated development environment, can be used with either Java or the Cocoa and Carbon frameworks. Mac OS X also provides a wide selection of open source tools, such as the GNU Compiler Collection (GCC), which is used to build Mach-O programs, the native runtime environment of Mac OS X.”
- JHCore
- “JHCore is a core database for the LambdaMOO MUD server. It is an excellent starting point from which you can build a wide range of applications. Many programmers from different fields have contributed their expertise, refining the best of MOO technologies and following months of extensive testing this has resulted in a efficient, robust and expressive package, capable of supporting development of the most exacting applications.”
- MOO-cows mailing list at Moo-Cows
- MOO-talk is now the general MOO discussion list, but you can still access some of the archives of MOO-cows.
- The MOO Home Page
- The links are dying, but this is apparently still the MOO home page.
- The Mac OS Mud Zone
- Lists some really old MOO implementations (and other MUD servers) in the servers section. Nice client links.
- Wizard basics and help on maintaining your own MOO
- This looks to be by far the best-kept MOO resource still available. And it contains LambdaCore.
- Fringe’s MOO Resources
- Looks like Fringe is still keeping up his links. He has a few more world cores there that might be interesting.
- Fraise: Jean-François Moy and Peter Borg
- Fraise is the successor to the great text editor Smultron. It’s an easy-to-use, powerful, free, text editor with tabs, split windows, syntax coloring, and more.
- Lingon: Peter Borg
- “An easy to use yet powerful app to run things automatically.”
- File Utilities Package
- This provides an interface between your MOO and your file system. It is useful for off-loading some items to the file system, as well as for triggering shell scripts from the MOO.
- Cup-O-Mud Java Telnet Client
- “The Cup-O MUD client is a fully functional client for Multi-User Virtual Environments written in the Java programming language. You can embed an active, real-time connection to a MUVE directly into a web page, allowing the user to not only interact with the system using their web browser, but also have most of the essential features most users of modern MUVE clients simply cannot live without (separate input/output windows, backscroll, command-recall, and more), all without the user having to download or install a single piece of software.”
- Come to Valhalla
- Valhalla is—or was—a MOO. MOO is a ‘programming language’ for creating multi-user dungeons (MUD). MOO is object oriented (thus, MUD, Object Oriented). MOO was created by Pavel Curtis and Xerox PARC, who are to be commended for their work. While MOO is ancient technology, there are still people who find it fun and useful.
November 15, 2008 note: I just tested this with Mac OS X 10.5.5 Leopard; it works with these steps, using the default compiler on Leopard. I also updated the link to the MOO-cows mailing list.