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
$102.50
Apple Inc.
+0.25
MSFT
$45.43
Microsoft Corpora
+0.55
GOOG
$571.60
Google Inc.
+2.40

MacTech Search:
Community Search:

Software Updates via MacUpdate

Path Finder 6.5.5 - Powerful, award-winn...
Path Finder is a file browser that combines the familiar Finder interface with the powerful utilities and innovative features. Just a small selection of the Path Finder 6 feature set: Dual pane... Read more
QuarkXPress 10.2.1 - Desktop publishing...
With QuarkXPress, you can communicate in all the ways you need to -- and always look professional -- in print and digital media, all in a single tool. Features include: Easy to Use -- QuarkXPress is... Read more
Skype 6.19.0.450 - Voice-over-internet p...
Skype allows you to talk to friends, family and co-workers across the Internet without the inconvenience of long distance telephone charges. Using peer-to-peer data transmission technology, Skype... Read more
VueScan 9.4.41 - Scanner software with a...
VueScan is a scanning program that works with most high-quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. VueScan is easy to use, and has... Read more
Cloud 3.0.0 - File sharing from your men...
Cloud is simple file sharing for the Mac. Drag a file from your Mac to the CloudApp icon in the menubar and we take care of the rest. A link to the file will automatically be copied to your clipboard... Read more
LibreOffice 4.3.1.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
SlingPlayer Plugin 3.3.20.505 - Browser...
SlingPlayer is the screen interface software that works hand-in-hand with the hardware inside the Slingbox to make your TV viewing experience just like that at home. It features an array of... Read more
Get Lyrical 3.8 - Auto-magically adds ly...
Get Lyrical auto-magically add lyrics to songs in iTunes. You can choose either a selection of tracks, or the current track. Or turn on "Active Tagging" to get lyrics for songs as you play them.... Read more
Viber 4.2.2 - Send messages and make cal...
Viber lets you send free messages and make free calls to other Viber users, on any device and network, in any country! Viber syncs your contacts, messages and call history with your mobile device,... Read more
Cocktail 7.6 - General maintenance and o...
Cocktail is a general purpose utility for OS X that lets you clean, repair and optimize your Mac. It is a powerful digital toolset that helps hundreds of thousands of Mac users around the world get... Read more

Latest Forum Discussions

See All

Rhonna Designs Magic (Photography)
Rhonna Designs Magic 1.0 Device: iOS Universal Category: Photography Price: $1.99, Version: 1.0 (iTunes) Description: Want to sprinkle *magic* on your photos? With RD Magic, you can add colors, filters, light leaks, bokeh, edges,... | Read more »
This Week at 148Apps: August 25-29, 2014
Shiny Happy App Reviews   | Read more »
Qube Kingdom – Tips, Tricks, Strategies,...
Qube Kingdom is a tower defense game from DeNA. You rally your troops – magicians, archers, knights, barbarians, and others – and fight against an evil menace looking to dominate your kingdom of tiny squares. Planning a war isn’t easy, so here are a... | Read more »
Qube Kingdom Review
Qube Kingdom Review By Nadia Oxford on August 29th, 2014 Our Rating: :: KIND OF A SQUARE KINGDOMUniversal App - Designed for iPhone and iPad Qube Kingdom has cute visuals, but it’s a pretty basic tower defense game at heart.   | Read more »
Fire in the Hole Review
Fire in the Hole Review By Rob Thomas on August 29th, 2014 Our Rating: :: WALK THE PLANKUniversal App - Designed for iPhone and iPad Seafoam’s Fire in the Hole looks like a bright, 8-bit throwback, but there’s not enough booty to... | Read more »
Alien Creeps TD is Now Available Worldwi...
Alien Creeps TD is Now Available Worldwide Posted by Ellis Spice on August 29th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Dodo Master Review
Dodo Master Review By Jordan Minor on August 29th, 2014 Our Rating: :: NEST EGGiPad Only App - Designed for the iPad Dodo Master is tough but fair, and that’s what makes it a joy to play.   | Read more »
Motorsport Manager Review
Motorsport Manager Review By Lee Hamlet on August 29th, 2014 Our Rating: :: MARVELOUS MANAGEMENTUniversal App - Designed for iPhone and iPad Despite its depth and sense of tactical freedom, Motorsport Manager is one of the most... | Read more »
Motorsport Manager – Beginner Tips, Tric...
The world of Motorsport management can be an unforgiving and merciless one, so to help with some of the stress that comes with running a successful race team, here are a few hints and tips to leave your opponents in the dust. | Read more »
CalPal Update Brings the App to 2.0, Add...
CalPal Update Brings the App to 2.0, Adds Lots of New Stuff Posted by Ellis Spice on August 29th, 2014 [ permalink ] | Read more »

Price Scanner via MacPrices.net

Apple now offering refurbished 21-inch 1.4GHz...
The Apple Store is now offering Apple Certified Refurbished 21″ 1.4GHz iMacs for $929 including free shipping plus Apple’s standard one-year warranty. Their price is $170 off the cost of new models,... Read more
Save $50 on the 2.5GHz Mac mini, on sale for...
B&H Photo has the 2.5GHz Mac mini on sale for $549.99 including free shipping. That’s $50 off MSRP, and B&H will also include a free copy of Parallels Desktop software. NY sales tax only. Read more
Save up to $300 on an iMac with Apple refurbi...
The Apple Store has Apple Certified Refurbished iMacs available for up to $300 off the cost of new models. Apple’s one-year warranty is standard, and shipping is free. These are the best prices on... Read more
The Rise of Phablets
Carlisle & Gallagher Consulting Group, a businesses and technology consulting firm focused solely on the financial services industry, has released an infographic depicting the convergence of... Read more
Bad Driver Database App Allows Good Drivers t...
Bad Driver Database 1.4 by Facile Group is a new iOS and Android app that lets users instantly input and see how many times a careless, reckless or just plain stupid driver has been added to the... Read more
Eddy – Cloud Music Player for iPhone/iPad Fre...
Ukraine based CapableBits announces the release of Eddy, its tiny, but smart and powerful cloud music player for iPhone and iPad that allows users to stream or download music directly from cloud... Read more
A&D Medical Launches Its WellnessConnecte...
For consumers and the healthcare providers and loved ones who care for them, A&D Medical, a leader in connected health and biometric measurement devices and services, has launched its... Read more
Anand Lal Shimpi Retires From AnandTech
Anand Lal Shimpi, whose AnandTech Website is famous for its meticulously detailed and thoroughgoing reviews and analysis, is packing it in. Lal Shimpi, who founded the tech site at age 14 in 1997,... Read more
2.5GHz Mac mini, Apple refurbished, in stock...
The Apple Store has Apple Certified Refurbished 2.5GHz Mac minis available for $509, $90 off MSRP. Apple’s one-year warranty is included, and shipping is free. Read more
13-inch 2.5GHz MacBook Pro on sale for $999,...
B&H Photo has the 13″ 2.5GHz MacBook Pro on sale for $999.99 including free shipping plus NY sales tax only. Their price is $100 off MSRP. Read more

Jobs Board

*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...
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
Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.