The Apple OS X Operating System


1.1 Apple OS X compared to Microsoft Windows

OS XMS Windows
commercial commercial
Darwin source code available for developerssource 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 grouphuge user group
requires specialist hardwaremultiple hardware vendors
more expensive (at low end)cheaper
crashes lesscrashes more, but hardware is better tested


1.2 Apple OS X compared to Linux

OS XLinux
commercialfree and commercial versions
Darwin source code available for developersopen source
requires specialist hardwaremultiple hardware vendors
more expensivecheap hardware, free OS
user contributed codeuser contributed code
Fink, Sourceforgedpkg, 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!

LinuxOS X
/etc/init.dLibrary/StartupItems
/etc/mach_init.d since 10.3
/procdifferent tools
iptablesipfw
/etc/passwdnetinfo


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


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


2.3 Processes

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


2.5 AppleScript

Script language for writing macros that interact with applications.

tell application "Finder"
beep
    get the name of the first item in the desktop
end tell


3.1 OS X file system

HFS+, Hierarchical File System Plus, Mac OS Extended Format


3.2 Other features of HFS+


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


3.7 Other file systems (supported by OS X)

acronymnameexplanation
HFSHierarchical File System Mac OS Standard Format for OS 8 and OS 9
UFS Unix File Systemmost Unix systems
UDFUniversal Disk Format for DVD volumes
ISO 9660standard 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; dynamic_pager )

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.

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 servers.

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


5.4 OS X's Open Directory

OS X uses either


5.5 Open Directory Architecture (built into any Mac)


5.6 Legacy Network Products that are supported


5.7 lookupd: information broker and cache


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.