It has been over a year since I migrated to a Macbook Pro laptop and started using the Mac OS X operating system. Since then, I have learned some useful tips and tricks, which I have shared below.
Using Keyboard Shortcuts
If you can master keyboard shortcuts, you will be able to perform some actions (especially repetitive ones) much faster than using the trackpad.
Enable Tabbing Between All Controls
This will allow you to tab to any control, such as a button, in a window or dialog.
- Go to “System Preferences” and Keyboard.
- In the “Full Keyboard Access: …” section at the bottom, make sure that the “All controls” radio option is checked.
Strangely, after you tab to a button, some dialogs require you to press the Return key and other dialogs require you to press the Space key in order to “click” the button.
Perform a Screen Capture
Use the following key combinations to perform either a full screenshot or a cropped screenshot:
- Simultaneously press Apple + Shift + 3 keys to perform a full screenshot.
- Simultaneously press Apple + Shift + 4 keys to enter cropped screenshot mode, where the cursor becomes a target icon. Click down, without releasing, to pick a corner of the shot and drag to frame the shot (you will see a translucent rectangle). Release to take the cropped screenshot.
The screenshots will appear on your desktop as PNG image files.
Select one or more files and simultaneously press Apple + Delete keys to delete them. This key combination will also work to delete folders. The deleted files and folders are placed in the waste basket.
Force Quit an Application
If your Mac OS X appears to be frozen due to an unresponsive program, one drastic measure is to kill that program’s process. Simultaneously press Command + Option + Esc keys to open up the “Force Quit Applications” dialog, select the offending application, and click on the “Force Quit” button.
Note: For more details on running applications (in addition to disk, memory, and network usage), you can launch the “Activity Monitor”.
Just for Fun
There are a ton of keyboard shortcuts. You just have to find the ones most useful to you. For example, here’s a fun shortcut: press Fn + Shift + F10 keys to make the current window bright and slowly move to the center, while everything else fades away.
Command Line With Terminal
The Terminal application is equivalent to the Linux shell or the DOS command prompt. For certain activities such as writing scripts or doing development, I prefer to use the command line. So I was very glad that Mac OS X came with the Terminal application. One can open several Terminals and even skin them so they will be partially transparent.
Launch an Application
One can launch a Mac OS X application from the Terminal by issuing the following commands:
- Run “open [application | file | directory | URL]” to launch a particular application (ex: “/Applications/TextEdit.app”), open a file with its default associated application, open a directory using Finder, or browse to a URL using the default browser respectively.
- Run “open -e [file]” to open a file with the TextEdit application.
- Run “open -a [application] [file]” to open a file using the specified application.
Debug the Wireless Network
Mac OS X comes with a nifty command line wireless utility called airport. To enable easy access to it, run the following to put it in the command line’s search path:
Once you have run the above, you can now issue the following commands:
- Run “airport -I” to see the current wireless status, what SSID you are connected to and the strength of the signal. Note that some of this info is also shown if you hold down Option key while clicking on the Airport status icon in the top menu bar (on the right-hand side).
- Run “airport -s” to scan the wireless broadcast space.
- Run “airport -z” to disassociate from any wireless network.
Some other useful commands are:
- Run “ifconfig en1” to see your machine’s assigned IP address on the wireless network.
- Run “dscacheutil -flushcache” to flush the DNS cache.
Where’s My CD?
To access another partition or a CD using Terminal, change to the “/Volumes” directory.
Reset Your Admin Password
If you ever forget your administrative password, there are two easy methods to reset the password. One requires the Mac OS X Install CD and the other does not.
Require the Mac OS X Install CD
First method is to boot from the Mac OS X Install CD and run the reset password application.
- Insert the Mac OS X Install CD and restart the Mac.
- Hold the “C” key on startup to boot from the CD.
- Once the specialized Mac OS X operating system on the CD is booted, go to menu “Utilities->Password Reset”.
- Select the Mac OS X hard drive.
- Select your username and input the new password.
- Restart the Mac.
Don’t Require Mac OS X Install CD
Second method uses single user mode and does not require the Mac OS X Install CD.
- Restart the Mac.
- On startup, hold the Command + S keys down to boot into single user mode.
- Once you have Terminal access, input the following commands to reset your password:
mount -uw /
shutdown -r now
The second command will show the list of users, one of which will be your username.
- Alternatively, if you wish to have Mac OS X prompt you to create a new administrative user, run the following command instead of the “passwd [your_username]”:
Deleting the .AppleSetupDone file will cause Mac OS X to re-run the setup wizard on bootup, which will prompt you to create a new user account with administrative permission. You can then run “System Preferences->Accounts” to reset any user’s password.
Note: Did you know that Mac OS X, like Windows, has a Safe Mode? If you ever need it, just hold the Shift key on bootup to go into Safe Mode.
Boot Camp for the Schizophrenic
Boot Camp comes with Mac OS X and allows you to dual-boot into either Mac OS X or Windows. It is very easy to setup as long as you have an official Windows installation CD with product key. The only decision you have to make is how much space to allocate to Windows; I recommend 32GB or more for Windows 7 to allow space for applications.
Run “Boot Camp Assistant” and follow the directions.
- The Windows Support Software can be considered Windows drivers for Mac hardware such as video cards, trackpad, etc. I consider it a requirement, otherwise Windows would not perform well on the Mac.
- For the “Download Windows Support Software” page, I selected the second option since I had the Mac OS X Installation CD. I did try the first option “Download the Windows support software…” on another Macbook but it failed after several minutes; maybe you will have better luck if you use this option.
- Per the instructions, insert the Windows installation CD and start the Boot Camp installation.
- Note: I recommend using an official, unmodified Windows CD. I tried this with a customized, no interaction Windows Install CD and its custom installation script repartitioned the whole drive as a Windows partition (thereby destroying the Mac OS X partition). To recover, I had to reinstall the Mac OS X operating system from scratch.
Once Boot Camp is installed, on startup, just hold the Option key down and you will be presented with a menu to select either Mac OS X or Windows to boot into. When you are in Windows, insert the Mac OS X Install CD to install the necessary Apple Windows drivers. Once installed, you will see a Boot Camp icon in the bottom-right dock which will allow you to configure the Trackpad, which OS to boot by default, etc.
Mac Keyboards Are Strange!
You will need to either get used to using Windows with the Mac keyboard or alternatively, to remap the Mac keys to match Windows.
Emacs The Way You Want It
Mac OS X comes with a command line version of Emacs. However, I’ve gotten used to GNU Emacs on Windows and wanted the same on the Mac OS X. Here’s how to install GNU Emacs on your Mac:
- Download the latest GNU Emacs for Mac OS X.
- Open the disk image and copy Emacs.app to the “/Applications” folder.
- You can launch GNU Emacs from the command line using “open -a /Applications/Emacs.app [file]”.
If you want to customize Emacs to disable the startup splash screen and enable mouse scrolling, create a “~/.emacs” file with the following content:
(setq inhibit-splash-screen t)
;;Increase width to 120 chars
(add-to-list 'default-frame-alist (cons 'width 120))
;;Set tab to be displayed as 4 spaces, not the default 8
(setq-default tab-width 4)
;;Enable wheelmouse support
;;Define the mouse scroll wheel
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
;;Support for scrolling (two finger scrolling is double-wheel-up/down)
(global-set-key [wheel-down] 'up-slightly)
(global-set-key [wheel-up] 'down-slightly)
(global-set-key [double-wheel-down] 'up-slightly)
(global-set-key [double-wheel-up] 'down-slightly)
(global-set-key [triple-wheel-down] 'up-slightly)
(global-set-key [triple-wheel-up] 'down-slightly)
Restart Emacs for the changes to take effect.
Remove Windows Return Characters
Files from Windows may contain return characters which show up as visually distracting ^M characters in Emacs. Worse, the Windows return characters inside a bash script file will cause errors on execution. To remove the Windows return characters, open the file in Emacs and perform one of these two methods:
- Type “Esc-x set-buffer-file-coding-system”, Enter key, “unix”, Enter key to switch the format to Unix (from Windows).
- Type “Esc-x replace-string Ctrl-q Ctrl-m” and Enter key to replace the Windows return characters with nothing. The Ctrl-q will allow you to type control characters into the input buffer, such as Ctrl-m for the Windows return character.
This is the dumping ground for random, but possibly useful tips.
When using VMWare Fusion running Windows, you will need to add Fn to the normal Windows keyboard shortcuts. For example:
- Use Fn + Control + Option + Delete keys to issue a Windows Ctrl-Alt-Delete command.
- Use Fn + Delete to issue a Windows Delete command.
To run Firefox in 32bit mode by default (so some legacy plugins can work):
- Go to /Application and select the Firefox icon.
- Left-click and select “Get Info” on the Firefox application.
- Check the “Open in 32-bit mode” box.
Did you know that you can issue commands in the Firefox address bar? Try the following:
- Input “about:blank” to get a blank page. (You can also set this as the home page.)
- Input “about:sessionrestore” to load the tabs that were opened in the previous session. Try using this if Firefox complains that it is unable to recover your saved tabs on startup.
- Input “about:plugins” to see a description of all the installed plugins.
The above will work in Firefox running on all supported operating systems.
Hopefully all the tips here will help you to enjoy your own Mac migration.