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

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.