Gestalt

Gestalt was the name of a system call introduced in 1989 with System 6.0.4 to allow applications to dynamically query what capabilities were present in the running Macintosh system configuration. Gestalt was deprecated in 2012 with the release of Mac OS X 10.8 and replaced by sysctl for hardware and ProcessInfo for software.

Background
Calls to identify machine type and configuration were available as early as 1987 with System 4.1. However, by the time of the introduction of the Macintosh IIci in 1989, the pace of Mac development had produced such a proliferation of hardware configurations and software add-ons from Apple and third parties that a simple version check was no longer enough to determine the features of the system. Instead, Gestalt maintains a dynamically-extensible table of OSType selector codes.

For instance, instead of checking the system version to deduce what version of the Sound Manager might be present, there is a separate Gestalt selector for directly querying the capabilities of the Sound Manager. Thus, it could be made possible for an application dependent on capabilities introduced in a newer Sound Manager to run on an older system which had the updated Sound Manager installed as an add-on, as well as on a newer system which had the new Sound Manager built-in. And of course the Sound Manager add-on could also query this Gestalt selector first to decide whether there was any point in installing itself into the current system.

The value returned by querying a selector code is 32 bits whose meaning depends on the selector. Some selectors define this as a version code, while others use it as a bit mask of available capabilities. Some subsystems define both types of selectors, allowing querying of both the version number and the capabilities. Some even use a Gestalt selector to pass the address of a shared block of data, or even the address of code that could be called. Since the piece of code that installed a Gestalt selector could either install a simple static value or a that Gestalt would invoke every time somebody queried the selector, it was possible for the value returned to vary dynamically from call to call, to reflect information about the current state of the subsystem.

3rd party utilities
As Gestalt calls were intended for developers, an early tool that allowed users to check system configurations of classic models was MacEnvy. Its usefulness became more limited as it was unaware of newer models with PowerPC processors. Other utilities such as Mac Identifier and Wish I were... allowed users to manipulate their Gestalt ID to install or run software that may otherwise block their system.

Apple began providing more of this information to users with Apple System Profiler, included as part of Mac OS 7.6 in January 1997.