TweetFollow Us on Twitter

UNIX On Your Desktop

Volume Number: 15 (1999)
Issue Number: 4
Column Tag: Development Environments

UNIX on Your Desktop

by Vicki Brown

A Look at MachTen and CodeBuilder

UNIX on Your Macintosh

Have you been thinking about running UNIX® on your Macintosh? Perhaps you'd like to get a head start on Mac OS X Server. Or you've been reading a lot about Linux in the news lately, and wonder what the fuss is about. Perhaps your company just added a Sun Solaris system or a Silicon Graphics Irix machine and you need to learn about UNIX. Or, you want to run a web server or an FTP server. Or, perhaps you're just curious. But you don't want to give up your Mac OS! What can you do?

Power MachTen from Tenon Intersystems <http://www.tenon.com> may be just what you need. Power MachTen is a complete implementation of a Berkeley UNIX Operating System for the Power Macintosh, using a Carnegie-Mellon Mach kernel. The entire MachTen UNIX environment runs as an application under Mac OS, just like any other application (with a few important differences). The Mac OS and MachTen share the processor, the hard drive, the network, and any peripherals you may have installed.

Power MachTen is a complete UNIX system, with many features such as network file sharing, multi-user login capability (via telnet), Web server, Domain Name services, and more. If you don't need the networking and file sharing features, you may instead want to take a look at CodeBuilder. CodeBuilder uses the same kernel and has many of the same UNIX features, but lacks the networking and file sharing capabilities of MachTen. If you're only interested in software development under a UNIX system, CodeBuilder may be the right choice.


Figure 1. CodeBuilder Console.

Source Code Development

The CodeBuilder environment includes a wide range of features to aid in source code development. CodeBuilder provides support for many popular languages, including Ada, C, C++, FORTRAN, Java, Objective-C, Perl, and Tcl/Tk. The development tools can be used to create Macintosh applications, Unix applications, or hybrid (Macintosh/Unix) applications.

In addition, CodeBuilder includes a choice of the most popular Unix shells: C-shell (csh), T-C Shell (tcsh), the "Bourne" shell (sh) and the Bourne Again Shell (bash). The shells are interactive command interpreters, required for issuing commands in the MachTen or CodeBuilder terminal windows. Each shell also has its own language which can be used for writing useful small programs called shell scripts. The default shell is Csh. However, if you are unsure about which shell to use, try bash. Of the four, this one has the most (and best) features available for both interactive use and script creation.

When you first launch CodeBuilder, it's easy to see that this is no ordinary Mac OS application! Indeed, CodeBuilder is a complete UNIX environment, sans networking features. When you log in you'll be presented with a new terminal window, and a shell prompt.

Tenon provides several accounts for the first-time user. These are: root, the system administration account, cbuser, the standard CodeBuilder account, and cbnext. The latter has the same privileges as cbuser but uses the CodeBuilder AfterStep desktop environment instead of simple terminal windows.

Be sure to log in as root the very first time and run the chnglicense command. Until you run this command and enter your registration number, CodeBuilder is operating on a temporary, expiring license. Although the command is run from the CodeBuilder command line, the chnglicense dialog has a distinctively Macintosh look to it. The initial dialog should appear with the current (temporary) number filled in. If it doesn't, make sure you have logged in as root to run the command.


Figure 2. chnglicense.

After you've registered, log in as cbuser and take a look around to get the feel of CodeBuilder. Pay particular attention to the sample_code directory which contains sample code in several languages.

cbuser@CodeBuilder% ls
sample_code
cbuser@CodeBuilder% ls sample_code
Ada             C++             Java            ReadMe
C               FORTRAN         Objective-C
cbuser@CodeBuilder% ls sample_code/*
sample_code/ReadMe

sample_code/Ada:
act-distrib     lovelace        mac-team

sample_code/C:
Makefile        hello.c         sillyballs.c

sample_code/C++:
Makefile        hello.C         square.cc

sample_code/FORTRAN:
Makefile        hello.F         wiggle.f

sample_code/Java:
Makefile        hello.java

sample_code/Objective-C:
gstep-base-0.2.10       hello
cbuser@CodeBuilder%

We're Not in Kansas Anymore...

If you have never used a UNIX system before, you should be aware that CodeBuilder is a very different environment from the Mac OS. If you've used MPW, you will at least be familiar with the ideas of a shell and a command-line interface. But even if you have MPW experience, UNIX will most likely seem very foreign.

The documentation for CodeBuilder should get you started, but you'll probably want to pick up a few books on using a UNIX system, and programming in a UNIX environment. There are quite a few of these available. If you are lucky enough to live or work near a good technical bookstore, I recommend you look through a number of books before choosing one. If you can't look at the books in person, be sure to ask for recommendations; there are a lot of bad books as well as good ones. Unfortunately, there aren't any books available about MachTen specifically; however, you should be able to find books that address the Berkeley versions of UNIX.

Note that there are books available that address the Mach kernel. However, these are unlikely to be of interest to most users of CodeBuilder! Unless you are planning to develop or modify UNIX kernels yourself, you'll probably want books that address the user interface and programming environment of a UNIX system.

While you're waiting for the books to arrive, you should explore the CodeBuilder environment. Read the manual (unlike most Macintosh applications, this is a manual you really should read). There is also extensive on-line documentation. The top-level Documentation folder on the CodeBuilder CD provides both printable and browsable (HTML) documentation. The printable documentation includes "info" documents for many GNU tools, the PostScript versions of the UNIX man pages, and many supplementary papers. Of course, the UNIX man pages (/usr/share/man) and the GNU info files (/usr/share/gnu) are available as well.

What if You Want Networking Too?

CodeBuilder is a nearly complete UNIX system, with a full development environment and (almost) every tool you might want. However, if you also need networking support, you'll want to look instead at Power MachTen . Power MachTen provides all the development support you get from CodeBuilder, as well as Network Filesystem, the Apache Web server, full telnet support (imagine logging into your Macintosh :-), Sun's NIS (Network Information Services), electronic mail support (sendmail and bind), Name Server capability, and more.

There are few noticeable differences. You'll see a few more daemons starting up when MachTen launches, as well as several additional files and directories. The MachTen Control Panel includes Network settings. If you have Mac OS 8.5 installed, you'll have to copy your networking data from the TCP/IP control panel; otherwise, MachTen is able to import the data for you. Because MachTen is networked, the initial accounts (here, mtuser and mtnext ) have passwords. Be sure to change the passwords for these accounts, and for root, after you register with chnglicense.


Figure 3. MachTen Console.

Networking at Mach Ten

Once you have MachTen installed, where do you go from there? For starters, MachTen enables you to develop applications in a UNIX-based environment, just as CodeBuilder does. But with MachTen , you can set up one Macintosh to be a server, and other users can log in remotely to compile their applications. Or, run X Window System applications from remote workstations (including other Macintoshes), with MachTen providing the server.

In a networked environment, you can use MachTen to run a high speed Internet server, complete with WWW, FTP, NFS, DNS and print services. Turn inexpensive Macintosh systems into reliable, network-based remote file servers for Xerox DocuTech Production Publishers (note: this capability is only available if the DocuTech's FTP feature is enabled). You can even run your company email through a MachTen server.

In combination with WebTen, Tenon's point and click Apache Web server, MachTen provides a powerful web development tool. Using the WebTen SDK, which runs under MachTen, you can develop plug-in Apache modules for the Macintosh. With minimal porting effort, you can migrate your plug-ins to WebTen or any other Apache web server environment.

Recently, the vendor of a Web programming application released a UNIX version of their product. In only a few days, working via remote login to a Powerbook running MachTen, this vendor was able to recompile the application to run in the cgi-bin folder under WebTen, all with a minimum amount of porting effort - and all over the Internet!

4.1.1 Pros and Cons - First Impressions

I've been using MachTen since 1991. It's come a long way in that time; Tenon has obviously been working diligently to improve the interface with the Mac OS while adding features that greatly improve usability and performance. Power MachTen 4.1.1 runs with System 8.5 and is supported on the latest G3 Power Books and even on the iMac.

Unlike its early predecessors, Power MachTen is a very well-behaved application. Long gone is the need to restart Mac OS upon quitting the MachTen application (a drawback of the earliest versions). Gone also is any confusion about who "owns" the networking functionality. When MachTen exits, your networked applications continue to function. Although Tenon's advanced TCP stack is an option, Open Transport is used by default.

Also improved over the years is the price. Power MachTen is available for US$249. If you don't need networking support, CodeBuilder is priced at just US$149. Compared to many large packages for the Mac OS (including software development environments), and considering what you get, this is a steal!

Support for both CodeBuilder and Power MachTen is excellent. Tenon's support staff is knowledgeable, and they answer email. There are certainly cheaper UNIX implementations on the market, but they don't come with nearly the same level of support as you'll find with MachTen.

Features and Functionality

Beginning with release 4.1, MachTen included a native fast file system, implemented within one (200 MB) Mac OS file. Although this approach removes the option of accessing MachTen files from the Finder, it has several advantages. For one, the fast file system, truly is faster, providing a two- to ten-fold performance improvement for the MachTen application. For another, those thousands of (mostly small) UNIX files aren't cluttering up your Mac OS folders, risking accidental deletion, renaming, or unintended modification!

Tenon has also been hard at work upgrading the development tool set. Release 4.1.1 includes C, C++, Objective-C, Ada95 (gnat 4.0.1), FORTRAN 77 (g77 0.5.23) and Java (kaffe0.92), as well as the EGCS (1.1b) compiler suite as an alternative development environment. Many of the included applications have also been updated. The Power MachTen CD includes a number of optional installable utilities, including bind 8.1.2, emacs 20.2, Perl 5.005_01, pine 3.96, and sendmail 8.8.8, and secure shell (ssh-1.2.25).

If you prefer to work within the X Window environment, that has been updated as well. X11R6 is included, along with over a hundred rebuilt and updated X client applications. The OpenGL libraries have also been updated (customers with OpenGL will need a new license). The Motif window manager has been replaced with the (compatible) lestif 0.85.3.

Not all roses...

Not all first impressions were positive. While Tenon has been spending its efforts on true interoperability and Mac OS system interaction, they have lagged a bit on the user interface side. Control panel dialogs are modal. Due to a bug in Mac OS 8.5, MachTen was unable to import my TCP/IP settings directly, and I had to type them in. I was unhappy to note that, with the MachTen Controls open, I could not switch over and open the TCP/IP Control Panel. I was, however, able to open the TCP/IP controls first, move the window to a convenient location, then open the MachTen Controls and start copying data.

I was also somewhat unhappy with the terminal windows. I've grown accustomed to the features of several available Telnet applications for the Mac - colored backgrounds, choice in cursors, WYSIWYG feedback when sizing windows. Much of this is missing from the MachTen and CodeBuilder terminal environments. On the other hand, once you have your windows sized and arranged as you like, MachTen will save your window environment. And there is one feature I especially like - the ability to choose between windows with the touch of a command key.

I was also unhappy about the chnglicense application which must be used to enter the CodeBuilder (or MachTen) serial number. The application, unfortunately, cannot be run from a menu, but must be entered at the command line. Be very sure to enter this the first time you run the application (don't get tempted to play first and forget). Also, note that you must run the chnglicense command as root (the manual doesn't say this). If you forget to enter your license number (or don't enter it as root) and your temporary license expires, you will need to re-install the application!

My major quibble is primarily for Apple, however, not for Tenon. When I installed MachTen on my Powerbook 2400, I was surprised to note that my delete key didn't work properly. Instead of erasing text, it sent the control sequence, ^H. Similarly, my arrow keys (which I rely upon) weren't working as I expected. Apparently, the Powerbook keymappings are, er, nonstandard. To address this, (if you have a Powerbook), you have two choices. Either add the line

	stty erase '^H'

to your .login file, or (if you're brave) edit resource 128 of the MachTen kchr resource using ResEdit.

Alternatives

If you're interested in UNIX on the Macintosh, there are a number of alternatives to Power MachTen. If you're still using a 68K-based Macintosh, Tenon still offers Professional MachTen 2.3. Professional MachTen is an implementation of Berkeley 4.3 UNIX for 68K-based Macintoshes (including the Classic and the Powerbook Duo). You'll need memory management support to take advantage of MachTen paging and memory protection.

Linux and the other BSDs

If you're willing to devote a few hard disk partitions (and reboot between using UNIX and using Mac OS), you can install any of several different UNIX variants as separate (non-integrated) operating systems. OpenBSD and NetBSD both offer versions of BSD (Berkeley) UNIX (similar to what is available with MachTen). OpenBSD (http://www.openbsd.org/) is a 4.4 BSD system which runs on 68K and (some) PowerPC Macintosh platforms. NetBSD runs on the 68K platform, but not yet on PowerPC architecture. Both OpenBSD and NetBSD come complete with source code and are available for a nominal cost.

If you prefer Linux (yet another version of UNIX), you may want to consider either MkLinux (http://www.mklinux.apple.com) or LinuxPPC (http://www.linuxppc.org). Both are based on RedHat Linux; MkLinux uses a Mach microkernel similar to that used by MachTen (hence the mk in the name). LinuxPPC does not. Both MkLinux and LinuxPPC are available only for the PowerPC Macintosh line. (Not all Power Macintoshes are supported, however). Both MkLinux and LinuxPPC come complete with source code and are available for a nominal cost.

The upside of the freely redistributable UNIX projects is that source code is available and everyone is invited to join in the development effort. The downside is that support is often ad hoc, consisting of mailing lists and Usenet news groups. Your choice should be made based on what you're looking for - a commercially supported environment, or a chance to get personally involved in your own UNIX system. You'll also need to decide whether the need to reboot the machine bothers you. Although MkLinux, for example, can access your HFS files, it cannot run concurrently with Mac OS.

Mac OS X Server

Coming soon from Apple Computer, Mac OS X Server (formerly Rhapsody) is also based on BSD 4.4. UNIX. Mac OS X Server was not available for review when this article was written, but the Mac OS X team has released some information.

It's still unclear whether Mac OS X server will ship with source code. However, 4.4 BSD source code is available elsewhere. Mac OS X server is not expected to include the X Window environment anytime soon. It will, however, be fully integrated with the Mac OS. The look and feel is slightly different (resembling the former NeXT environment) but it will be a mostly familiar GUI. If you're planning to develop code for the next generation of Macintosh computers, Mac OS X server may be what you want.

If you're comparing UNIX versions by price, Mac OS X server is currently described as having a suggested retail price of US$1000. At four times the cost of MachTen and considerably more than the cost of a MkLinux CD-ROM, you'll have to decide if the features it provides are worth the price.

UNIX lookalikes - Mac 06

Finally, if you're interested in learning about UNIX, but don't really feel the need to install a complete UNIX system, there are several UNIX "shell" lookalikes available as shareware. One promising candidate is currently in active development. Mac06 (pronounced "Mac oh six") is a POSIX compatible UNIX-like application that runs on top of Mac OS. It supports both 68K and PowerPC Macintoshes and has full Finder integration.

The software is currently free (when version 1.0 is finalized, it will become shareware). During the development period, feedback (as well as donations) are cordially invited. It's a interesting project. Take a look at <http://www.dsitri.de/projects/mac06/index.html> for complete information and download.

Bibliography and References

  • UNIX® has been a trademark of many organizations in the years since its inception at Bell Labs in 1969. Currently, UNIX is a registered trademark of The Open Group <http://www.opengroup.org/trademarks.html>.
  • CodeBuilder and MachTen are products of Tenon Intersystems. Complete information is available at <http://www.tenon.com>. Details regarding the WebTen SDK are available at <http://www.tenon.com/products/webten/SDK>.
  • Apache is the industry standard Open Source Web Server. See <http://www.apache.org> for additional information and details.
  • Kernighan, Brian and Pike, Rob. The UNIX Programming Environment. First published fifteen years ago, this book remains a classic, describing both the programming environment and the philosophy behind a UNIX system.

Vicki Brown has been programming computers for about 20 years now. She discovered Unix in 1983 and the Macintosh in 1986. Unix is her favorite OS, but the Mac OS is her favorite user interface. She changed her desktop machine to a Macintosh five years ago. Vicki is currently employed as a Perl programmer for a Silicon Valley Biotech firm. She is the co-author of MacPerl: Power and Ease. When she's not programming or writing, Vicki enjoys relaxing with her spouse and their two Maine Coon cats.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »

Price Scanner via MacPrices.net

Apple is offering significant discounts on 16...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more
Limited-time sale: 13-inch M3 MacBook Airs fo...
Amazon has the base 13″ M3 MacBook Air (8GB/256GB) in stock and on sale for a limited time for $989 shipped. That’s $110 off MSRP, and it’s the lowest price we’ve seen so far for an M3-powered... Read more
13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more

Jobs Board

Operating Room Assistant - *Apple* Hill Sur...
Operating Room Assistant - Apple Hill Surgical Center - Day Location: WellSpan Health, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.