Neal Parikh / email@example.com / www.nparikh.org February 11, 2003
Table of Contents
1. Table of Contents 2. Introduction 3. Why Unix? 4. What’s Darwin? 5. Basics of Darwin 6. Introduction to shells 7. Running system commands 8. Basic shell customization 9. Permissions
10. Running programs 11. What’s NetInfo? 12. Basics of compilation 13. ProcessManagement 14. Introduction to text editors: Pico, Emacs, and Vi 15. Introduction to X Windows / X11
This FAQ is intended to be a quick primer on Mac OS X’s BSD Subsystem. The BSD Subsystem is a powerful tool that gives you an immense array of new capabilities and access to a large number of new applications. If you learn to use them wisely, you can do some trulyincredible things.
That is the main question, isn’t it? Many people are confused as to why Apple has picked Unix in the ﬁrst place. There are several reasons why Apple has picked Unix to be the core of their new OS (not in order of importance):
1. The historical reason: Mac OS X’s roots trace back to NeXTSTEP, and that used Unix. 2. Developers who may be unfamiliar with the Macplatform will likely have some level of familiarity with Unix, which aids porting eﬀorts. 3. Most users who have studied computer science in either school or college have encountered Unix on some level, and must have some basic familiarity with it. 4. There’s a reason almost every server in the world runs Unix. A vast amount of administration software, and a lot of it that runs very stably. A Unixserver, properly conﬁgured, can be very low maintenance. 5. Having an open source core makes the OS more ﬂexible. For example, there’s no way of upgrading the OS 9 version of Personal WebSharing without Apple releasing a software update. If you ﬁnd that Apache (the world-standard webserver included with OS X) is out of date, you can just go to the website, download the source code, and update thatpart of the OS. Having much of the core capability written in open source code also allows third party developers to help solve problems and contribute new features. 6. Application availability. As OS X becomes a more and more compatible Unix, more and more Unix applications will become available. 7. Having an operating system that can run consumer applications oﬀ-the-shelf as well as run higher-endopen source server software is somewhat of a holy grail. It’s a win-win situation for Apple, developers, and users.
There may be other reasons as well, but in short, Unix is a foundation that will carry Apple through the next decade or more.
Darwin is an open source operating system based in part of BSD Unix and is in the same family as FreeBSD, NetBSD andOpenBSD. Darwin is the core of Mac OS X but it is, on its own, a complete Unix operating system. The Terminal program located in /Applications/Utilities allows you to use the Unix core. To see a history of the development of various Unices, go to http://perso.wanadoo.fr/levenez/Unix/. NeXTSTEP, Darwin, and Mac OS X are at the very end of the 12-page timeline.
Q: What is aTerminal? A: A Terminal is simply a text-based program that is used to send commands to the OS and interact with it. In the case of Mac OS X, the Terminal program allows the user to interact with the BSD subsystem directly. Q: What can I do with the Terminal? A: You can do almost anything, because the Terminal is basically a window into another OS. Mac programs now often take advantage of the Unixlayer, although Unix programs rarely take advantage of the Mac layer. In the Terminal, you can run an IRC client like epic or irssi, browse the web with links or lynx, read Usenet newsgroups with the tin newsreader, play Tetris in emacs, write programs, write documents, manage your ﬁlesystem, run maintenance and/or system checks, inspect network traﬃc, handle system administration, and so on and so...