Mac OS X basics for Windows and Linux users

From REALbasicWiki

Jump to: navigation, search

If your favorite development platform is Windows or Linux, you may not know how Mac OS X works and what Mac-users expect.


Image:Warning24.png Mac-users are usually considered as very demanding users and most of the softwares not obeying the Mac "look-and-feel" are just put apart, unless there are no better software available.

Contents

[edit] Introduction to Mac OS X

The Mac operating system incarnations before version 10 (aka Mac OS X) were lacking a number of "modern system" features and it became urgent for Apple to propose a brand new system, while keeping the maximum backward compatibility. To make a long story short, Apple bought the NeXT company (also founded by Steve Jobs) and its UNIX-based operating system NeXTStep. The goal was to mix altogether to make a new modern system while keeping end-users away from all the UNIX stuff.

  • Darwin is the name of the UNIX base, i.e. the lowest level of the system.
  • On top of Darwin are all the graphics and media stuff
  • Then come the application frameworks (the high-level functions):
    • Carbon, the updated version of the old Mac OS
    • Cocoa, the new framework inherited from NeXTStep
    • Java

For more information, see Mac OS X System Overview from Apple (accessed 2008-03-10)

As of REALbasic 2008r1, you can easily use Darwin (with Declares or the Shell) and Carbon (with Declares). Cocoa is much more difficult to use.

[edit] Code names

Each main version of Mac OS X has its own code name, just like any other operating system. The difference is that Apple really communicates around those names. They were all chosen considering that digital life is a jungle (e.g. hence the name Safari for Apple's web browser) and the operating system should be the king of that jungle. Apple then chose cat names:

  • 10.0: Cheetah
  • 10.1: Puma
  • 10.2: Jaguar
  • 10.3: Panther
  • 10.4: Tiger
  • 10.5: Leopard


[edit] The menu bar

On Mac OS X, the menu bar is always at the top of the screen. It depends on the application rather than on the window. From the left there is:

  • The Apple menu, which contains system-specific items
  • The application menu. It displays the name of the frontmost (i.e. active) application. It most notably contains:
    • The About the_application_name item which should display a window with information about the application.
    • The Preferences... item, which should allow to edit application preferences.
    • The Quit the_application_name item, to quit the application.
  • The File menu
  • The Edit menu
  • then anything you need
  • The Help menu

Note: Any menu item which will open a new window (instead of executing immediately without user interaction) must have a trailing "…".

[edit] Consequences

The menu bar is attached to an application and not to a particular window. That means that an application is still alive even if it has no window opened. This is in stark contrast with Windows or Linux applications where the menu bar is attached to a window, so if the window is closed, there is no longer any way to interact with the application (which is then automatically closed).

[edit] Keyboard shortcuts

Many keyboard shortcuts for menu items are clearly defined by Apple, as well as they are expected from macusers.

All shortcuts use the command key (⌘ or ) possibly with ⇧ (shift), ⌥ (option, or alt) or ⌃ (control). Be aware that a shortcut like ⌘. must actually be typed as ⇧⌘; on a french keyboard. Similarly, ⌘+ becomes ⇧⌘=.

⌘Q Quit application
⌘N New document
⌘O Open document...
⌘S Save document...
⇧⌘S Save as...
⌘W Close window
⌘P Print...
⇧⌘P Print setup...
⌘Z Undo
⌘C Copy
⌘X Cut
⌘V Paste
⌘A Select all
⌘, Preferences...
⌘? (or Help key) Help
⌘. Cancel

NOTE: you cannot use ⌘1, ⌘2, ⌘3, ⌘4 on the main keyboard (but you can use 1, 2, 3, 4 on the keypad) because they are used by the system.

[edit] Filesystem

[edit] Disk format

The default filesystem format is journaled HFS+ (see HFS Plus on Wikipedia). Though this format can be made case-sensitive, it is strongly recommended not to do so.

  • Max volume size: 16 million TB
  • Max filename length: 255 UTF-16 characters
  • Allowed characters in filename: any unicode character
  • Max pathname length: unlimited
  • Max files or folders in a folder: 231
  • Max file size: 16 TB (imposed by the system. Older system version had lower limits)

[edit] Paths

Mac OS X uses several types of path:

  • Typical Mac OS paths, which use a colon as a separator and begin with the volume name, e.g. my volume:a Folder:my File.txt. Any unicode character is allowed except the colon.
  • UNIX paths (POSIX), which use a slash as a separator. / itself is the filesystem root, which is also the startup volume. Other volumes must be accessed as /Volumes/my_volume_name.
  • URL paths in some parts of the system.

NOTE: the slash character is allowed in Mac OS paths but not in POSIX paths. Inversely, the colon character is allowed in POSIX paths but not in Mac OS paths. As a consequence, a filename containing a slash in the Finder is actually stored on disk, i.e. at the UNIX level, with a colon instead.

[edit] Special folders

Because Mac OS X is UNIX-based, it inherits the UNIX folder hierarchy:

  • Root filesystem: /
  • UNIX folders: (they are automatically hidden to the user in the Finder)
    • /automount
    • /bin
    • /cores
    • /dev
    • /etc
    • /home
    • /mach
    • /net
    • /private
    • /sbin
    • /tmp
    • /usr
    • /var
  • Mac OS X special folders: Note that the name of such folders is automatically localized in the Finder
    • /Applications - All the applications
    • /Library - Admin-writeable folder which contains user-installed system extensions, fonts, QuickTime codecs, screen savers, builtin Apache website... Items in this folder are made available to any user on the system.
    • /Network - Not displayed in the Finder
    • /System - The system itself. It is not writeable (except by root) and should not be modified.
    • /Users - Contains one folder for each user on the system (his/her home folder, also abbreviated by the ~ (Tilde) character in UNIX)
    • /Volumes - Mounting point for all the volumes. It is not directly displayed in the Finder, which shows each volume as individual entities

[edit] The user's home folder

Every local user (i.e. every user who can locally log into the system) has a home folder. By default, such folder is stored in the /Users/ folder and uses the user's UNIX name (aka short name). However, it is possible that the home folder is located elsewhere, be it on another local partition or on the network. At the UNIX level, ~ (Tilde) is a path shortcut for the current user's home folder.

By default, the home folder contains the following folders (note that names are localized at high-level):

~/Desktop User's desktop
~/Documents
~/Downloads (new in Leopard) Safari downloads
~/Library See below.
~/Movies
~/Music
~/Pictures
~/Public Documents made available to everyone on the network by the user. Also contains a Drop box so anybody can send files to the user (a write-only folder).
~/Sites The user's personal website. Can be accessed as http://computer_IP/~user_name.

The ~/Library folder contains a lot of folders. Many of them are identical to those found in /Library (i.e. at the root level) so users can install their own fonts, QuickTime components, preference panes, screen savers, widgets and so on, even if they do not have administrative privileges. This is where you should store application preferences (with the RB SpecialFolder.Preferences method).

[edit] Distributing your application on Mac OS X

Unless absolutely necessary (e.g. complex installation, installing libraries...) you should not provide any installer package but rather a simple disk image (with a .dmg extension) containing your application bundle and possibly a Read me file and whatever you want. End-user will install the application simply by dragging its icon to the Applications folder.

More details on Installer policy document on Apple website.

[edit] See also

Personal tools
related