Mac tips (not only) for switchers
If you are new to the Mac, everything can feel a bit off. This post tries to help. And might even teach you something new if you are already familiar with the Mac. I am also mentioning some advanced things which should be interesting for programmers and people coming from Linux.
Terminology
- Option key ⌥: Mac speak for “Alt”.
- Command key ⌘: Used for menu commands.
- Aqua: The name of the Mac OS X GUI. Meaning: You can usually
substitute “GUI” for “Aqua”, sometimes also used to differentiate
X11-based programs from true Mac OS X programs.
- Cocoa: An object-oriented API for writing Mac OS X programs, inherited from the NeXT operating system. A variant of Cocoa, Cocoa Touch is used on iOS devices (which run a port of Mac OS X).
File System
- Applications: Mac applications are just directories whose name
ends with “.app”, in the Finder, you can use the context menu to look
inside such a folder.
- Thus, one can easily bundle files with an application. This was used when Apple switched from PowerPC processors to Intel processors to include binaries for both architectures in a single application.
- Applications are easy to install and uninstall: You just copy
them wherever you want to use them and trash them for deinstallation. Alternative ways of installing are via Installer packages and the Mac App Store.
- File system layout: Inspired by the Unix /usr/bin etc., but a bit easier to understand.
- Hidden files: Under the Finder (but not under the shell) much of Mac OS X's Unix personality is hidden. Similarly to Unix, files whose names start with a dot are not shown in the Finder.
Terminal
- Use an Option click to position the cursor in the terminal, e.g. when you are using emacs over ssh.
- Open files with Mac applications:
- open . # open the current directory with the finder
- open -a textedit myfile.txt
- open -a textedit # just open the program
- Drop files on a Terminal window to paste their path.
- ssh-agent: Already runs for the complete session (including all GUI apps). Thus, you only need to ssh-add your keys (via Terminal).
GUI, various apps
- Drag and drop
- D&D and Option-Tab: You can use Option-Tab during D&D, in order to easily transfer data between programs.
- D&D a file on Mail.app: Creates a new email message whose attachment is the file.
- Finder: Command-clicking on a window title gives you a list of folders enclosing the current one.
- Sleep display:
- Put the cursor in a hot corner. Use “System Preferences →
Desktop + Screen Saver → Hot Corners” (or search for “corner”) to
configure a corner so that the display is put to sleep if the cursor
stays in it.
- Type Ctrl-Shift-Eject
Keyboard and keyboard shortcuts
- Mac OS X has many keyboard shortcuts [4].
- Many Emacs key bindings work in Mac applications (Ctrl-A, Ctrl-E, Ctrl-K, etc.)
- Keyboard and character viewer menu: can be enabled via the “Keyboard” preference pane. Allows you to access characters such as arrows from any application.
- Use F1, F2, etc. as function keys: Helpful if you develop with an IDE, enabled via the “Keyboard” preference pane.
- Command key combinations and dialog windows: In some cases, you can use a Command key combination to click a button. For example: When you are in danger of overwriting a file, a dialog appears and you can use Command-R to replace or Command-D for “Don’t Save”.
- Shut down dialog: activate via Ctrl-Eject, type the initial character of any of the buttons to click them.
Making screen shots
- Including a mouse pointer in the shot: This is where the “Grab” application helps.
- Entire screen, window, selection: See Preview.app, menu “File” which has a submenu for screenshots.
- Entire screen: Command-Shift-3
- Selection: Command-Shift-4
- Benefit: Can also be used to count pixels on screen
- Variation: Hit space and get a cursor that selects a window to be shot.
Spotlight [5]
- Activate via Command-Space
- Calculations: addition, multiplication, etc. Even sin and cos work. [6]
- Filter by file type: For example, “kind: pdf”.
- Phrases: Put words that should appear in a given order, next to each other, in quotes.
- Exclude folders: Use the Spotlight preference pane to hide some folder from indexing and appearing in search results.
Enabling Hidden Features in Apple's Programs.
Apple's apps store their preferences quite cleverly in a tree that can
be accessed from the command line. Thus, the following hacks are
possible. Close the application before performing them.
- iTunes: By default, the Ping button transports you to the iTunes store. Option-click instead gets you to your own library. The following preference makes the latter the default.
- In Terminal type: defaults write com.apple.iTunes invertStoreLinks -bool YES
- Safari: Enable the debug menu (which has some nifty stuff in it, you can e.g. change the user agent)
- Type: defaults write com.apple.Safari IncludeDebugMenu 1
- Terminal: Enable focus-follows-mouse
- Type: defaults write com.apple.Terminal FocusFollowsMouse -string YES
Related reading
- Mac OS X 10.6 Snow Leopard: the Ars Technica review
- Essential Mac applications
- Gimp on Mac OS X
- Mac OS X keyboard shortcuts
- 11 Tips To Use Spotlight More Efficiently
- Spotlight - Calculator Functions
- Mac keyboard and trackpad: save battery power