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.

 
AAPL
$111.78
Apple Inc.
-0.87
MSFT
$47.66
Microsoft Corpora
+0.14
GOOG
$516.35
Google Inc.
+5.25

MacTech Search:
Community Search:

Software Updates via MacUpdate

LibreOffice 4.3.5.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
CleanApp 5.0.0 Beta 5 - Application dein...
CleanApp is an application deinstaller and archiver.... Your hard drive gets fuller day by day, but do you know why? CleanApp 5 provides you with insights how to reclaim disk space. There are... Read more
Monolingual 1.6.2 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
NetShade 6.1 - Browse privately using an...
NetShade is an Internet security tool that conceals your IP address on the web. NetShade routes your Web connection through either a public anonymous proxy server, or one of NetShade's own dedicated... Read more
calibre 2.13 - Complete e-library manage...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Mellel 3.3.7 - Powerful word processor w...
Mellel is the leading word processor for OS X and has been widely considered the industry standard since its inception. Mellel focuses on writers and scholars for technical writing and multilingual... Read more
ScreenFlow 5.0.1 - Create screen recordi...
Save 10% with the exclusive MacUpdate coupon code: AFMacUpdate10 Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your... Read more
Simon 4.0 - Monitor changes and crashes...
Simon monitors websites and alerts you of crashes and changes. Select pages to monitor, choose your alert options, and customize your settings. Simon does the rest. Keep a watchful eye on your... Read more
BBEdit 11.0.2 - Powerful text and HTML e...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more
ExpanDrive 4.2.1 - Access cloud storage...
ExpanDrive builds cloud storage in every application, acts just like a USB drive plugged into your Mac. With ExpanDrive, you can securely access any remote file server directly from the Finder or... Read more

Latest Forum Discussions

See All

Make your own Tribez Figures (and More)...
Make your own Tribez Figures (and More) with Toyze Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
So Many Holiday iOS Sales Oh My Goodness...
The holiday season is in full-swing, which means a whole lot of iOS apps and games are going on sale. A bunch already have, in fact. Naturally this means we’re putting together a hand-picked list of the best discounts and sales we can find in order... | Read more »
It’s Bird vs. Bird in the New PvP Mode f...
It’s Bird vs. Bird in the New PvP Mode for Angry Birds Epic Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Telltale Games and Mojang Announce Minec...
Telltale Games and Mojang Announce Minecraft: Story Mode – A Telltale Games Series Posted by Jessica Fisher on December 19th, 2014 [ permalink ] | Read more »
WarChest and Splash Damage Annouce Their...
WarChest and Splash Damage Annouce Their New Game: Tempo Posted by Jessica Fisher on December 19th, 2014 [ permalink ] WarChest Ltd and Splash Damage Ltd are teaming up again to work | Read more »
BulkyPix Celebrates its 6th Anniversary...
BulkyPix Celebrates its 6th Anniversary with a Bunch of Free Games Posted by Jessica Fisher on December 19th, 2014 [ permalink ] BulkyPix has | Read more »
Indulge in Japanese cuisine in Cooking F...
Indulge in Japanese cuisine in Cooking Fever’s new sushi-themed update Posted by Simon Reed on December 19th, 2014 [ permalink ] Lithuanian developer Nordcurrent has yet again updated its restaurant simulat | Read more »
Badland Daydream Level Pack Arrives to C...
Badland Daydream Level Pack Arrives to Celebrate 20 Million Downloads Posted by Ellis Spice on December 19th, 2014 [ permalink ] | Read more »
Far Cry 4, Assassin’s Creed Unity, Desti...
Far Cry 4, Assassin’s Creed Unity, Destiny, and Beyond – AppSpy Takes a Look at AAA Companion Apps Posted by Rob Rich on December 19th, 2014 [ permalink ] These day | Read more »
A Bunch of Halfbrick Games Are Going Fre...
A Bunch of Halfbrick Games Are Going Free for the Holidays Posted by Ellis Spice on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »

Price Scanner via MacPrices.net

The Apple Store offering free next-day shippi...
The Apple Store is now offering free next-day shipping on all in stock items if ordered before 12/23/14 at 10:00am PT. Local store pickup is also available within an hour of ordering for any in stock... Read more
It’s 1992 Again At Sony Pictures, Except For...
Techcrunch’s John Biggs interviewed a Sony Pictures Entertainment (SPE) employee, who quite understandably wished to remain anonymous, regarding post-hack conditions in SPE’s L.A office, explaining “... Read more
Holiday sales this weekend: MacBook Pros for...
 B&H Photo has new MacBook Pros on sale for up to $300 off MSRP as part of their Holiday pricing. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.2GHz Retina MacBook Pro: $1699... Read more
Holiday sales this weekend: MacBook Airs for...
B&H Photo has 2014 MacBook Airs on sale for up to $120 off MSRP, for a limited time, for the Thanksgiving/Christmas Holiday shopping season. Shipping is free, and B&H charges NY sales tax... Read more
Holiday sales this weekend: iMacs for up to $...
B&H Photo has 21″ and 27″ iMacs on sale for up to $200 off MSRP including free shipping plus NY sales tax only. B&H will also include a free copy of Parallels Desktop software: - 21″ 1.4GHz... Read more
Holiday sales this weekend: Mac minis availab...
B&H Photo has new 2014 Mac minis on sale for up to $80 off MSRP. Shipping is free, and B&H charges NY sales tax only: - 1.4GHz Mac mini: $459 $40 off MSRP - 2.6GHz Mac mini: $629 $70 off MSRP... Read more
Holiday sales this weekend: Mac Pros for up t...
B&H Photo has Mac Pros on sale for up to $500 off MSRP. Shipping is free, and B&H charges sales tax in NY only: - 3.7GHz 4-core Mac Pro: $2599, $400 off MSRP - 3.5GHz 6-core Mac Pro: $3499, $... Read more
Save up to $400 on MacBooks with Apple Certif...
The Apple Store has Apple Certified Refurbished 2014 MacBook Pros and MacBook Airs available for up to $400 off the cost of new models. An Apple one-year warranty is included with each model, and... Read more
Save up to $300 on Macs, $30 on iPads with Ap...
Purchase a new Mac or iPad at The Apple Store for Education and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free,... Read more
iOS and Android OS Targeted by Man-in-the-Mid...
Cloud services security provider Akamai Technologies, Inc. has released, through the company’s Prolexic Security Engineering & Research Team (PLXsert), a new cybersecurity threat advisory. The... Read more

Jobs Board

*Apple* Store Leader Program (US) - Apple, I...
…Summary Learn and grow as you explore the art of leadership at the Apple Store. You'll master our retail business inside and out through training, hands-on experience, Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.