HOME

TheInfoList



OR:

In
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The ...
System 7 System 7, codenamed "Big Bang", and also known as Mac OS 7, is a graphical user interface-based operating system for Macintosh computers and is part of the classic Mac OS series of operating systems. It was introduced on May 13, 1991, by Apple Co ...
and later, and in
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
, an alias is a small file that represents another object in a local, remote, or removable
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
and provides a dynamic link to it; the target object may be moved or renamed, and the alias will still link to it (unless the original file is recreated; such an alias is ambiguous and how it is resolved depends on the version of macOS). In Windows, a "shortcut", a file with a .lnk extension, performs a similar function. It is similar to the
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
symbolic link In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto. Symbolic links are supported by POSIX and by most Unix-like operating system ...
, but with the distinction of working even if the target file moves to another location on the same disk (in this case it acts like a
hard link In computing, a hard link is a directory entry (in a directory-based file system) that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file acc ...
, but the source and target of the link may be on different filesystems, and the target of the link may be a directory). As a descendant of
BSD The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
, macOS supports Unix symbolic (and hard) links as well.


Function

An alias acts as a stand-in for any object in the file system, such as a
document A document is a written, drawn, presented, or memorialized representation of thought, often the manifestation of non-fictional, as well as fictional, content. The word originates from the Latin ''Documentum'', which denotes a "teaching" or ...
, an
application Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a c ...
, a folder, a
hard disk A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magnet ...
, a
network share In computing, a shared resource, or network share, is a computer resource made available from one host to other hosts on a computer network. It is a device or piece of information on a computer that can be remotely accessed from another comput ...
or removable medium or a
printer Printer may refer to: Technology * Printer (publishing), a person or a company * Printer (computing), a hardware device * Optical printer for motion picture films People * Nariman Printer ( fl. c. 1940), Indian journalist and activist * Jame ...
. When double-clicked, the computer will act the same way as if the original file had been double-clicked. Likewise, choosing an alias file from within a 'File Open'
dialog box The dialog box (also called dialogue box (non-U.S. English), message box or simply dialog) is a graphical control element in the form of a small window that communicates information to the user and prompts them for a response. Dialog boxes are ...
would open the original file. The purpose of an alias is to assist the user in managing large numbers of files by providing alternative ways to access them without having to copy the files themselves. While a typical alias under the classic Mac OS was small, between 1 and 5 KB, under macOS it can be fairly large, more than 5 MB (5000 KB) for the alias to a folder.


Preventing alias failure

An alias is a dynamic reference to an object. The original may be moved to another place ''within the same filesystem'', without breaking the link. The
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
stores several pieces of information about the original in the
resource fork The resource fork is a fork (file system), fork or section of a computer file, file on Apple Inc., Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with t ...
of the alias file. Examples of the information used to locate the original are: * path * file ID (inode number) * directory ID (inode number) * name * file size Since any of these properties can change without the computer's knowledge, as a result of user activity, various search algorithms are used to find the most plausible target. This fault-tolerance sets the alias apart from similar functions in some other operating systems, such as the
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
symbolic link In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto. Symbolic links are supported by POSIX and by most Unix-like operating system ...
or the
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
shortcut Shortcut may refer to: Navigation * Rat running or shortcut, a minor-road alternative to a signposted route * File shortcut, a handle which allows the user to find a file or resource located in a different directory or folder on a computer * Key ...
, at the expense of increased complexity and unpredictability. For example, an application can be moved from one directory to another within the same filesystem, but an existing alias would still launch the same application when double-clicked. The question can arise of how an alias should work if a file is moved, and then a file is created with the same name as the original moved file, since the alias can be used to locate both the original name and the new location of the original file. With symbolic links the reference is unambiguous (soft links refer to the new file, hard links to the original). Before Mac OS X 10.2, however, such an ambiguous alias would consistently find the original moved file, rather than the recreated file. In Mac OS X 10.2 and later releases, the new file is found, matching the behaviour of symbolic link

macOS applications can programmatically use the old behavior if required. Aliases are similar in operation to shadow (OS/2), shadows in the graphical
Workplace Shell The Workplace Shell (WPS) is an object-oriented desktop shell (also called desktop environment) produced by IBM's Boca Raton development lab for OS/2 2.0. It is based on Common User Access and made a radical shift away from the Program Manager t ...
of the
OS/2 OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
operating system.


Distinguishing marks

In System 7 through
Mac OS 9 Mac OS 9 is the ninth major release of Apple Inc., Apple's classic Mac OS operating system which was succeeded by macOS, Mac OS X (renamed to OS X in 2011 and macOS in 2016) in 2001. Introduced on October 23, 1999, it was promoted by Apple as "T ...
, aliases distinguished themselves visually to the user by the fact that their file names were in italics. To accommodate languages that don't have italics (such as
Japanese Japanese may refer to: * Something from or related to Japan, an island country in East Asia * Japanese language, spoken mainly in Japan * Japanese people, the ethnic group that identifies with Japan through ancestry or culture ** Japanese diaspor ...
), in
Mac OS 8.5 Mac OS 8 is an operating system that was released by Apple Computer on July 26, 1997. It includes the largest overhaul of the classic Mac OS experience since the release of System 7, approximately six years before. It places a greater emphasis ...
another distinguishing mark was added, badging with an "alias arrow"—a black arrow with a small white border—similar to that used for shortcuts in Microsoft Windows. In
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
, the filenames of aliases are not italicized, but the arrow badge remains.


File structure

The alias files in macOS start by the magic number 62 6F 6F 6B 00 00 00 00 6D 61 72 6B 00 00 00 00 which is in
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
book␀␀␀␀mark␀␀␀␀ ( representing the
Null character The null character (also null terminator) is a control character with the value zero. It is present in many character sets, including those defined by the Baudot and ITA2 codes, ISO/IEC 646 (or ASCII), the C0 control code, the Universal Coded Ch ...
). Following the magic number, it has been reported that an alias has a set of records inside it, each record is 150 bytes long and consists of the fields shown below (all integers are big endian). However, alias files are far larger than this would explain, and include other information at least including icons. # 4 bytes user type name/app creator code = long ASCII text string (none = 0) # 2 bytes record size = short unsigned total length # 2 bytes record version = short integer version (current version = 2) # 2 bytes alias kind = short integer value (file = 0; directory = 1) # 1 byte volume name string length = byte unsigned length # 27 bytes volume name string (if volume name string < 27 chars then pad with zeros) # 4 bytes volume created mac date = long unsigned value in seconds since beginning 1904 to 2040 # 2 bytes volume signature = short unsigned HFS value # 2 bytes volume type = short integer mac os value (types are Fixed HD = 0; Network Disk = 1; 400kB FD = 2;800kB FD = 3; 1.4MB FD = 4; Other Ejectable Media = 5 ) # 4 bytes parent directory id = long unsigned HFS value # 1 bytes file name string length = byte unsigned length # 63 bytes file name string (if file name string < 63 chars then pad with zeros) # 4 bytes file number = long unsigned HFS value # 4 bytes file created mac date = long unsigned value in seconds since beginning 1904 to 2040 # 4 bytes file type name = long ASCII text string # 4 bytes file creator name = long ASCII text string # 2 bytes nlvl From (directories from alias thru to root) = short integer range # 2 bytes nlvl To (directories from root thru to source) = short integer range (if alias on different volume then set above to -1) # 4 bytes volume attributes = long hex flags # 2 bytes volume file system id = short integer HFS value # 10 bytes reserved = 80-bit value set to zero # 4+ bytes optional extra data strings = short integer type + short unsigned string length (types are Extended Info End = -1; Directory Name = 0; Directory IDs = 1; Absolute Path = 2; AppleShare Zone Name = 3; AppleShare Server Name = 4; AppleShare User Name = 5; Driver Name = 6; Revised AppleShare info = 9; AppleRemoteAccess dialup info = 10) # string data = hex dump # odd lengths have a 1 byte odd string length pad = byte value set to zero


Alias record structure outside of size length

The following is for use with the Apple's Alias Resource Manager. # 4 bytes resource type name = long ASCII text string # 2 bytes resource ID = short integer value # 2 bytes resource end pad = short value set to zero Java code to flag an alias file // This function checks whether a file matches the alias magic number. public static boolean checkForMacAliasFile(File inputFile) throws FileNotFoundException, IOException There is
github repo with working C++ code here


Managing aliases


User interface

In System 7, the only way to create an alias was to select the original and choose "Make Alias" from the "File" menu. An alias, with the same name and " alias" appended would then be created in the same folder. In later versions, it became possible to create aliases by
drag-and-drop In computer graphical user interfaces, drag and drop is a pointing device gesture in which the user selects a virtual object by "grabbing" it and dragging it to a different location or onto another virtual object. In general, it can be used to ...
, while holding down the command and option modifier keys. Mac OS 8.5 added a feature for re-connecting aliases that had been broken for one reason or another (when the simple search algorithms failed to find a reliable replacement). This was done by selecting a new target through the standard Open File dialog. In Mac OS 8.5 options were added for
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
- option
dragging In computing, a pointing device gesture or mouse gesture (or simply gesture) is a way of combining pointing device or finger movements and clicks that the software recognizes as a specific computer event and responds to accordingly. They can be ...
an object in the Finder to create an alias at that location. This is where the ''alias cursor'' was added to the system. The cursor mirrors the appearance of the "create shortcut" cursor on Windows systems.


Programming API

The Alias Manager API is part of
Carbon Carbon () is a chemical element with the symbol C and atomic number 6. It is nonmetallic and tetravalent In chemistry, the valence (US spelling) or valency (British spelling) of an element is the measure of its combining capacity with o ...
. It is unknown whether it was present in Mac OS Classic.
Mac OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
10.6 introduced some alias-related APIs to
Cocoa Cocoa may refer to: Chocolate * Chocolate * ''Theobroma cacao'', the cocoa tree * Cocoa bean, seed of ''Theobroma cacao'' * Chocolate liquor, or cocoa liquor, pure, liquid chocolate extracted from the cocoa bean, including both cocoa butter and ...
, as a part of .


Relation to BSD symbolic and hard links

Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
and similar operating systems provide 2 features very similar to macOS aliases:
symbolic links In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto. Symbolic links are supported by POSIX and by most Unix-like operating syst ...
and
hard links In computing, a hard link is a directory entry (in a directory-based file system) that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file acc ...
. When using the macOS Finder, links are displayed and treated largely like macOS aliases, and even carry an identical "Kind" attribute. However, when using the shell command line, macOS aliases are not recognized: for example, you cannot use the ''cd'' command with the name of an alias file. This is because an alias is implemented as a file on the disk that must be interpreted by an API while links are implemented within the filesystem and are thus functional at any level of the OS. There is currently no pre-installed command to resolve an alias to the path of the file or directory it refers to. However, a freely available C program makes use of the Mac
Carbon Carbon () is a chemical element with the symbol C and atomic number 6. It is nonmetallic and tetravalent In chemistry, the valence (US spelling) or valency (British spelling) of an element is the measure of its combining capacity with o ...
APIs to perform this task. Given that, commands such as ''cd'' can be set up to check for aliases and treat them just like symbolic or hard links.


References


External links


System 7 aliases
— Article about System 7 aliases, from 1992 {{Computer files Macintosh operating systems Apple Inc. file systems