Floodgap's Power
MachTen Hacking Page: Classic Mac Unix in the 21st
Century!
Welcome to my little nook on an unusual way to use a classic Power
Macintosh: Unix. No, not OS X, Linux or NetBSD,
but a true BSD-based Unix running within the Classic MacOS.
In this little collection of notes and pages, we'll talk about why you
wouldn't want to use it, we'll talk to the few of you who would,
the differences between this environment and other Unixy things, and how to
get PowerMachTen to feature parity with your favourite Unix environment.
These pages are neither written by nor endorsed by Tenon Intersystems. MachTen is a trademark
of Tenon.
Last modified 5 August 2009.
Power MachTen is a commercial package and is on sale of this writing
for just
$99!
Don't ask me for a copy, I will ignore your message. It's NOT
abandonware. And yes, my installation is fully legal and paid for.
What is MachTen?
MachTen is a Mach-based environment that runs as an application under the
classic Mac OS (I run it under OS 9.2.2, but it will happily run under
Systems as old as 7.x). Much like Mac OS X, Mach operates as the system's
kernel and a BSD userland (in this case based on BSD4.4) sits on top;
unlike OS X, however, the Mach kernel runs as a regular Mac application and
implements a virtual machine which manages the pre-emptive multitasking of
processes running within MachTen. In effect, it's OS X turned inside out:
in OS X Tiger, the classic MacOS
runs as an app within Mach, whereas under MachTen,
Mach runs as an app within the classic MacOS.
Because it's "just another application," one of MachTen's strongest features
is that it multitasks with other Classic applications. Have X11 open and be
typing away happily in Office 98! Surf the web with Classilla
while MachTen chews
through a data set! While this multitasking is cooperative like any other
classic OS application,
the fact you can set the kernel's priority and have other regular
apps running at the same time dramatically increases its usefulness.
Power MachTen also comes with many "standard features" most Unix distros
would come with, including its own version of X11 (X11R6, using AfterStep),
a C-compiler (gcc 2.8.1), various toolchains and the standard
userland. Unfortunately many of these packages are now rather out of date;
getting them up to snuff is part of what this site is for.
There are two forms of MachTen, but I will only talk about one here. The
original Professional
MachTen was developed for 68000-based Macintoshes and
exists up to version 2.3. This original version has an older codebase but has
certain features that Power MachTen lacks, such as true virtual memory and
protected memory. For 68K Macs, however, A/UX is easy to find on the
(ahem) used market and has a devoted userbase that readily generates
ports of most essential utilities (example: comp.unix.aux).
It also has the weight of historical interest, and lamentably Professional
MachTen has none of these things going for it, so I won't discuss it further
on this site. Professional MachTen will not run on a PowerPC (confirmed by
Tenon, so don't even bother to try), and even to run Power MachTen
needs a
library update for 9.1 and 9.2.2.
What's different about MachTen?
Most of MachTen acts just like Unix, because other than the microkernel, that's
what it is. However,
besides the obvious difference in operating environments,
Power MachTen does have one other critical difference between it and many other
Unices: it is a real memory operating system. While you can run it
with Virtual Memory turned on (which would be unabashedly slow and stupid),
it itself has no virtual memory management. More to the point, it has no
protected memory, so it is possible for a rogue app to stomp all over the
system (or, more typically, a buggy app or memory hungry app to stomp
all over the system). While there are various kludges to deal with this,
they are not automatic and they don't always work. Every so often, you're
going to make a wrong move, usually while compiling a large and complicated
package, and MachTen will politely freeze up.
(Please don't interpret the last paragraph as me saying MachTen is unstable,
because under normal use it's perfectly steady. However, if you stress it
or grind it with things like compilers that can thrash memory a lot,
sooner or later something is going to glitch, and MachTen does have kernel
bugs.)
However, the memory situation isn't all bad. Power MachTen is one of a few
Classic Mac applications that can grab memory from the system dynamically
(and, optimistically, give it back sometimes) instead of booting up with a
fixed allocation set in the Finder. In fact, you should not futz with
its allocations, or you will actually give it less memory to run.
This is one reason why it works as well as it does in OS 9, and why it will
almost certainly not run under OS X in Classic.
Speaking of OS X ...
Why would I use MachTen if I have Mac OS X?
If you simply want Unix on a Mac (or if all you have is an Intel Mac),
stop reading this page. You have
several better and currently supported options, not the least of which being
Mac OS X itself, which is Mach, has a BSD userland, and is actually supported
by Apple. Those of us in the know use another *BSD (I am a longtime fan of
NetBSD, even back to the MacBSD days),
and some of you who don't know any better might even use Linux.
All of these are better supported and (sorry, Tenon) are almost certainly
better suited for your purposes.
There is one situation where, however, MachTen will be your best solution,
and it comes in two parts:
- You have to run Classic applications (particularly simultaneously)
and
- You have to have a locally running X11
and/or Unix environment. (Most of the time this means
you need to have direct access to your filesystem -- MachTen can mount
any Mac drive as a Unix volume, even AppleShare volumes, and understands
resource and data forks.)
Remember that Steve "The Destroyer of History" Jobs, in his infinite
turtlenecked iPod squawking Woz baiting Cupertino huffing glory, has removed
Classic support from Leopard, and we can confidently expect him to toss Tiger
in the unsupported dustbin any day now, not that Classic was a full substitute
for OS 9 anyway. (And while I love SheepShaver, it is even worse than Classic
with regard to compatibility, not to mention stability, and Basilisk doesn't
run PPC apps at all!)
This means running Classic apps is best done on OS 9 itself.
However, there is no need to run MachTen if you don't need your Unix local;
in fact, it's probably better for you just to go buy a mini or dust off that
old tower, slap OS X on it, stick it headless in the closet and use NCSA
Telnet to talk to it. Or go find a cheap PC and toss FreeBSD on it and do
the same thing. If you have netatalk, you can even mount the other
side as a drive as if it were local (and don't forget that OS 9 does speak
AFP-over-TCP). For many people this is the best approach.
That said, if you need Classic apps and you want a local Unix,
including the
best implementation of an X11 server ever written for the classic Mac OS, then
MachTen is your best bet.
Can I use MachTen as a client?
Can I use MachTen as a server?
The answer to both is yes. If you check Allow Incoming Connections in the
MachTen control panel, then inetd starts up when you boot MachTen,
and connections can be received from the outside world. If you uncheck this,
it is simply a standalone workstation; you can do things like
ssh forwarding and run apps in X like any client, or run client
apps like a browser. (The ssh is rather old, however, so you will
want to replace it. See my notes on
building packages to get your system
up to snuff.)
Please don't boot it as a server, however, without going through
/etc/inetd.conf and
/etc/rc.conf and disabling darn near everything. Many of
these utilities are quite old (and some, like telnetd, don't work
right), and some have security holes. If you want to make your MachTen
installation into a server, see my notes on
building packages to get your system
up to snuff
first!
What's the best way to set up Power MachTen?
These are, based on my heavy hitting and use, my tips for smooth usage:
- Make a separate partition (or add a separate hard disk) and install
MachTen to that. The reason is you will crash sooner or later and
sooner or later that crash is going to take out the filesystem with it,
and if that happens to your main drive you run the risk of making your system
unbootable (don't ask how I know this). If you install to a separate
partition or separate disk than your System Folder, then even if MachTen
poops its pants and the HFS+ on its home disk at the same time,
you can still boot and run DiskWarrior on it.
- Update your CPU if you can. Power MachTen does not care how you do this
(things like Sonnet CPU cards work great). The only thing that might be glitchy
is 68K machines updated with PowerPC cards, depending on their implementation.
- Get plenty of real RAM, and turn Virtual Memory off. The 1.25GHz MDD
FW400 dual G4 was the natively fastest (and last) Mac to run OS 9, which is
why I bought one, and with 2GB in this unit OS 9 sees 1.5GB which MachTen can
use nearly all of. Although MachTen says 32MB is the minimum, you're asking
for trouble with that. 64MB or 128MB would be my recommendation, and none of
the systems I have ever run MachTen on have had less than 512MB. RAM is
cheap, so go buy some, ya cheapskate.
- Avoid running File Sharing at the same time. You can have AppleShare
volumes mounted, just don't be sharing your own files to another box
simultaneously. This really bogs things down.
- Clean out your Extensions and Control Panels. C'mon, you knew I was
going to say that.
- If you're mostly using MachTen as a server, move the slider bar in the
MachTen control panel three ticks from the Unix side (maybe a hair closer if
you are doing a CPU-intensive job). However, if you're mostly using MachTen
as a client (like in X11), move it back a bit towards Mac because the closer
to the Unix side, the less MachTen will yield the CPU to the OS for the UI.
Why do you like MachTen?
- It's weird and different.
- I do have to run Classic apps, and I like having a local Unix
environment for certain toolsets.
- It is fun to hack in (and not a little bit dangerous).
- I'm weird and different.
So let's hack, buddy!
I want to get some user skillz.
This is a tips page giving you some advanced knowledge Tenon doesn't
mention in the (otherwise superb) manual, including common annoyances,
common tasks, ways for running MachTen
over a wireless LAN (and DHCP in general), and easy ways to
maintain filesystems simultaneously between MachTen and your Mac, which
is of course the whole point of a local Unix. Other grab bag stuff
will also go here.
I want to build new packages
to get my system up to scratch.
This step-through goes through the basics and pitfalls of building packages
on MachTen. At the end of this long tunnel, your MachTen will have a working
implementation of OpenSSL and OpenSSH along with updated versions of
zlib, perl and a number of other important tools. I
recommend you start here before you work on anything else
so you know what you're up against. I've also included a few things that I
just can't get to work. Maybe you can. You're awesome.
I want a web browser.
For some reason the benchmark of any OS is whether it can run a browser, and
for some reason Lynx just doesn't qualify. Yes, you can compile and run a
browser on MachTen. No, it's not Firefox. But it'll do. (Still, a better idea
is to run Classilla --
disclaimer: yours truly is the current lead maintainer.)
If you're looking for my NCSA Mosaic-CK pages, which were written for MachTen
but probably compile on other things, go to the
Mosaic-CK port page.
Cameron Kaiser