These notes provide additional information about using Perforce on Macintosh. You can find all past and present versions of the Perforce clients and server on our ftp site. For general product information, see the Perforce home page
For the various Macintosh platforms, Perforce offers the following products.
Operating System | Perforce products |
Classic: OS 9.x and below, which supports the classic Mac Toolbox and Carbon. ("Carbon" is a portability layer that is similar to the Mac Toolbox, but runs both on Classic MacOS and OS X. Carbon enables developers to port their classic Mac Toolbox-based code to MacOS X.) |
|
Darwin: Apple's Open Source operating system, which
is also the core of Mac OS X. Darwin is similar to FreeBSD UNIX. Darwin
does not include Aqua (the new MacOS X GUI), Cocoa, or Carbon. Though Darwin
supports HFS+ filesystems, it does not handle forked files or Macintosh
Type and Creator attributes.
Note: If you use the Darwin client on MacOS X and run the p4 edit command, any Carbon applications you use on that file will believe that the file is still locked. To avoid this problem, use the MacOS X client. IMPORTANT: The Perforce server on Darwin is case-insensitive, unlike Perforce servers on other UNIX platforms. |
|
OS X: Apple's new UNIX-based operating system. OS X runs on top of Darwin and includes Aqua, Carbon, Cocoa, and all Apple-specific development libraries. |
|
The Macintosh clients may be used with any Perforce server, release #99.1 or greater. Perforce offers the following Macintosh clients:
The following table describes the Macintosh clients in more detail.
Client | Platform | GUI? | Supports dual-forked files | InternetConfig File-Typing | Additional Requirements | Line Endings | Path Separators | File-Locking Technique |
---|---|---|---|---|---|---|---|---|
MPW Tool | Classic MacOS | no | yes | yes | MPW | Carriage Return | ':' | HFS+ Immutable Bit |
CodeWarrior Plugin | Classic MacOS | yes | yes | yes | CodeWarrior | Carriage Return | ':' | HFS+ Immutable Bit |
Darwin Perforce Client | Darwin / MacOS X | no | no | no | none | Line Feed | '/' | UNIX Permissions |
MacOS X Perforce Client | MacOS X | no | yes | no | none | Line Feed | '/' | HFS+ Immutable Bit |
Notes
Before you install the Perforce MPW Tool, you must install MPW.
To install the MPW tool:
To automatically set these variables when you reboot, put the preceding "set" commands into an MPW script, for example MPW:Startup Items:UserStartup•Perforce.
To verify that you have successfully installed the MPW Tool, issue the P4 command from MPW. If the MPW Tool is installed correctly, it displays a list of common Perforce commands.
When you issue commands in MPW, you must press the ENTER key, normally located on the numeric keypad, and not the RETURN key.
To ensure that MPW does not attempt to parse Perforce file specification that include special characters (specifically "/", "#", "...", and "*"), enclose such file specification in single or double quotes. For example:
Right: p4 sync -n "//depot/.../myfile#none"
Wrong: p4 sync -n //depot/.../myfile#none (because MPW treats characters following "#" as a comment)
The MPW Tool reads and writes text files using Macintosh line endings.
To install the Darwin client:
For details about using the Perforce command line client, see the Perforce user documentation and release notes.
To install and use the Perforce OS X client, use the Terminal application located in <System>/Applications/Utilities/Terminal.
To install the OS X client:
When issuing commands using the OS X command line client, note the following:
Sometimes you may want to delete all the files in a client workspace, either to change the root of the client of for some other reason. Some of you may have experienced trouble with emptying the trash when it contains locked files. This is a problem with the Mac OS X finder and not perforce.
It is possible to bulk lock/unlock files from the command-line. Here are some commands that will help you...
Bulk Unlocking | find . -type f -print0 | xargs -0 -n 1 SetFile -a l | unlocks all the files in the current directory and below |
Bulk Locking | find . -type f -print0 | xargs -0 -n 1 SetFile -a L | locks all the files in the current directory and below |
When you add files to a Perforce depot, Perforce assigns each file a file type, which determines how the file is stored and whether it can be diffed. The file type is initially assigned by the Perforce client program with which you add the file. After the file is added, you can change the file type.
Perforce Macintosh client programs determine file type as follows:
Note that Macintosh considers more characters printable than UNIX and NT do (mostly the "option" characters). A file added from the Mac might be assigned the text file type -- the same file added from UNIX might be assigned the binary file type.
The line ending character used in a text file depends on the platform on which the file originates. The following table lists the conventions.
Platform | Line ending |
UNIX | Linefeed (LF) |
Windows | Carriage return Linefeed (CRLF) |
Macintosh | Carriage return (CR) |
In the Perforce depot, text files are stored using UNIX line endings. Perforce client workspaces can be configured to translate line endings to the convention used by the client platform, or to perform no translation when files are synced. To set the line ending option, edit your client specification.
When you edit text files, your text editor can change the line ending when you save the file. If you disable translation of line endings on a Macintosh client, you might inadvertently submit text files containing Macintosh line endings to the depot. The Perforce server cannot diff such files, which it must do to store your changes. To avoid this problem, configure your text editor to save files using UNIX line endings.
Perforce handles Macintosh file forks as follows.
Perforce assigns the apple file type to Macintosh files with the following characteristics:
When an apple file is synced to a non-Macintosh client workspace (version 99.2 or higher), it is stored on the client as AppleDouble. For example, Macintosh file myfile, if synced to a non-Macintosh client workspace, is stored as myfile (data fork) plus %myfile (resource fork). Perforce Mac clients maintain only the file's data fork, resource fork, and finfo structure. Any other AppleSingle constructs are ignored when submitting or syncing files between the Mac client and the server.
If you sync an apple file to a 99.1 or earlier client, the file is stored on the client as a binary file, and will be unreadable unless you use a third-party tool that reads AppleSingle files.
Warning: To avoid data corruption, do not assign the apple file type to non-Macintosh files.
In version 99.1 and earlier, Perforce stores data and resource forks in separate files. The resource fork is assigned the the original file name with a period prepended. When working with Macintosh files using pre-99.2 Perforce servers, observe the following:
If you've been using the old resource file type, and want to change to the new apple scheme:
The Perforce server can now handle spaces in file names (spaces are very common in Mac file names), but not characters that the server machine considers to be non-printable. Thus the Mac "option" characters cannot appear in filenames stored in the Perforce server. Mac files with /'s in their names are likely to cause problems, as Perforce considers / to be a path separator.
$Id$