The Apple OS X Operating System
1.1 Apple OS X compared to Microsoft Windows
|OS X||MS Windows
| commercial ||commercial
|Darwin source code available for developers||source code is secret
|commercial focus on multimedia
||commercial focus on personal and business use
|iLife Suite (Music, Photo, Movie)
||MS Office (database, spreadsheet, word processing)
|small user group||huge user group
|requires specialist hardware||multiple hardware vendors
|more expensive (at low end)||cheaper
|crashes less||crashes more, but hardware is better tested
1.2 Apple OS X compared to Linux
|commercial||free and commercial versions
|Darwin source code available for developers||open source
|requires specialist hardware||multiple hardware vendors
|more expensive||cheap hardware, free OS
|user contributed code||user contributed code
|Fink, Sourceforge||dpkg, rpm, Sourceforge
But they are very different flavours of Unix!
1.3 Apple OS X compared to Linux - continued
About 50% of what you learned about Linux this semester
is different for OS X!
/etc/mach_init.d since 10.3
- The options for many commands are different.
1.4 Unix software
OS X comes preinstalled with apache, perl, python, java, etc.
Apple provides free downloads for Xcode (Developer Tools with
compilers, debuggers, Java tools, Project Builder, Documentation
etc.), X11, etc.
fink.sourceforge.net is an open source OS X software repository with
binaries for many Unix tools (Gnome, KDE, Perl libraries, PDF and Postscript
tools, databases, etc).
Installation of any other Unix software from source code is possible
but can be difficult if the software does not explicitly support OS X.
2.1 OS X internals
- Aqua: user interface (including Desktop and Finder)
- Classic, Carbon, and Cocoa: application environments
- Quartz: windows + graphics (including OpenGL, QuickDraw,
QuickTime, native PDF!)
- Darwin: operating system core (Mach 3.0, 4.4 BSD)
2.1.1 Remark: Microkernel vs. Monolithic System
In the famous "Tanenbaum vs Linus" email, Tanenbaum criticises Linux
because Linux uses a monolithic kernel, as opposed to a
modular microkernel. Mach is a microkernel.
Tanenbaum concluded in 1992 that "Linux is obsolete" ...
2.2 Application environments
- Classic emulator: legacy OS 9 code
- Carbon: procedural C-based APIs which run both on OS X and OS 9
- Cocoa: object-oriented API for developing in Objective-C and Java
BSD processes (with PID) are different from Carbon processes (with PSN).
"ps -axw" shows both numbers.
If the Classic emulator is run, all its PSNs correspond to one PID.
2.4 Applications, Frameworks and Extensions
- Traditional applications are bundled into one directory (with .app
(In the GUI these look like a single executable.)
- Frameworks are collections of libraries (with .framework extension).
- Kernel Extensions (Plugins): dynamic loading of code into the kernel without
Script language for writing macros that interact with applications.
tell application "Finder"
get the name of the first item in the desktop
3.1 OS X file system
HFS+, Hierarchical File System Plus, Mac OS Extended Format
- data fork: contains the actual user data
- resource fork: contains additional information, e.g. type and creator
codes, thumbnail images, comments
3.2 Other features of HFS+
- HFS+ is a case preserving, case insensitive filesystem
- Each file and directory has a unique, persistent ID.
- Supports both creation and modification dates.
- Does not support sparse files, but zero-fills
all bytes allocated for a file until end-of-file.
3.3 Aliases versus symbolic links
Symbolic links are implemented as a reference to a path in the file system.
If a file is moved the link breaks; but if the file is replaced with a
new version, the link remains valid.
Aliases are references to an ID. They always refer to the same file even
if it is moved. But they break if the file is replaced with a new version.
3.4 Working with the resource fork
GUI commands (cut, copy, paste, drag) automatically affect both forks.
Some BSD commands do not work with the resource fork!
3.5 Viewing the resource fork
For file SOMEFILE, the resource fork can be listed with
3.6 BSD commands affected by the resource fork
"mv" affects both forks, "cp" and "tar" do not
- use "ditto" instead of "cp"
- use "hfstar" instead of "tar"
3.7 Other file systems (supported by OS X)
|HFS||Hierarchical File System||
Mac OS Standard Format for OS 8 and OS 9
|UFS ||Unix File System||most Unix systems
|UDF||Universal Disk Format|| for DVD volumes
| ||ISO 9660||standard format for CD-ROM volumes
From a GUI view, there is no difference between these.
4.1 OS X System Startup
1) Open Firmware
2) /System/Library/CoreServices/BootX (boot loader)
3) /sbin/mach_init (mach service naming)
4) /sbin/init (BSD init; PID 1; determines runlevel)
5) /etc/rc.boot (single user; netboot in case of network boot; fsck)
6) /etc/rc (multi-user startup; mount file system; cleanup; sysctl variables;
syslogd; kextd; read mach_init.d; portmap; netinfo; update; vm;
7) /sbin/SystemStarter (/System/Library/StartupItems; /Library/StartupItems)
8) CoreGraphics; WindowServer; loginwindow
4.2 Startup items
OS X 10.2 and prior uses
/System/Library/StartupItems (for system startup items)
and /Library/StartupItems (for locally installed items).
Since OS 10.3: /etc/mach_init.d for system startup items and
/etc/mach_init_per_user.d for user startup items. (Both are directories
containing .plist files.)
5.1 Users and Groups
/etc/passwd and /etc/group are only read in single-user mode.
It is easiest to add users and groups using the GUI utilities.
- On the command-line, users can be added with niload passwd.
- On the command-line, the home directories can be created with
sudo ditto -rsrc /System/Library/User\ Template/English.lproj /Users/username
5.2 Remark: OS X Server
There are two versions of OS X: one for workstations and one for
The server version has special GUI and command-line tools
(such as serversetup and serveradmin) for all kinds of admin tasks.
5.3 Directory Services
- maintain information about all users (names, passwords, and preferences),
printers and other resources on a network in a single location
- users can login to a computer on the network with their personal
5.4 OS X's Open Directory
OS X uses either
- Netinfo (for local database)
- can be configured to act as client to Active Directory (Microsoft)
5.5 Open Directory Architecture (built into any Mac)
- Directory and authentication frameworks
- Open Directory API
- Directory services
- BSD flatfiles (/etc)
- Netinfo (local database + schema)
- NIS (client)
- LDAPv3 (client and custom map of OS X Server)
- Active directory (client)
- Crypt, kerberos, SASL (client)
5.6 Legacy Network Products that are supported
- AppleTalk: networking before OS X
- Rendezvous: zero configuration network for file sharing, printers, etc
- SLP: file and print services over IP
- SMB: Server Message Block (Microsoft)
5.7 lookupd: information broker and cache
- for user accounts, groups, printers, e-mail aliases, computer names,
- keeps a cache of recently requested items to improve system performance.
- search strategy for DNS, for NIS, for flat files
- query directory services, Netinfo etc
- categories are users, groups, hosts, networks, services, protocols, rpcs,
mounts, printers, bootparams, bootp, aliases, and netgroups.
6.1 Summary: OS X
Modern commercial Unix system + multimedia enhanced personal computer
in one box.
OS X supports a variety of file system formats, networking protocols,
directory access, etc.
OS X also supports pre-OS X legacy code which is not Unix-like at all.
Maybe: because Apple is not the market leader, OS X has to strive for
compatibility with other systems.