Tag Archives: mac - Page 3

Changing OS X Short Name

When my work laptop was originally set up the short name was set to “paul kehrer”. This space tends to cause issues with poorly written applications, especially on the command line, so I set out to change it. Prior to Leopard this was a difficult task best accomplished with ChangeShortName, but with Leopard you can now do it without any third party utilities.

advancedoptionsFirst you’ll need to create a secondary admin account and log into that. While you can directly change the short name of an account you are logged into, I wouldn’t recommend it. Next, open system preferences, go to accounts, and right click the user you want to change. You’ll see a single menu item called “advanced options…”.

useroptionsChoosing that will bring up a sheet that lets you change your user ID, group ID, short name, logins hell, home directory path, UUID, and add/remove aliases (other login names) for your account. While these are all very powerful tools we’re only going to use short name and home directory this time. In general it is safest to keep your short name and home directory path synchronized to avoid any issues that might arise from poorly written apps, but it is not required to change both. If you do change the home dir, then be aware that you’ll also need to run this command from the terminal to complete your account switch.

sudo mv /Users/oldshortname /Users/newshortname

Once you’ve done this you can log back in to the other account and you’re all set. Be aware that some apps do use hard coded paths for preferences, so you’ll probably have a few small issues to correct as you get up to speed.

Right Click On A Mac Trackpad

rightclickmacThis one is pretty basic, but nonetheless very important. As OS X laptops become more prevalent among less technical users I’ve noticed that there are quite a few people who aren’t aware that right click is available on their laptop. To enable this in Leopard (10.5)1, open system preferences, select the trackpad prefpane and check the “secondary click” (or “secondary tap” if you have tap to click turned on). Now simply rest two fingers on the trackpad and click (or tap two at the same time for tap click).

  1. This process is essentially the same in Tiger (10.4) and Panther (10.3), but the trackpad preferences are found within the “Keyboard & Mouse” prefpane.

Full Keyboard Access in OS X

fullkeyboardaccess
A coworker got a Macbook Pro for work today and he immediately noticed that by default you can’t tab through all controls in OS X. Enter Full Keyboard Access!

To enable this incredibly useful feature open System Preferences, select Keyboard & Mouse, and then choose Keyboard Shortcuts. At the bottom of the window you’ll notice two radio buttons. Change it to “all controls” and you’re set! You can now tab (or arrow key) through radio buttons, check boxes, buttons, et cetera in almost anything.

Highlighted items will have a thin color around them (in your configured highlight color, typically blue or grey) and you can activate them via space bar. There are also a few other really useful (and undocumented) shortcuts you can use with full keyboard access turned on:
Ctrl-F2 (Focus on Menu Bar)
Ctrl-F3 (Focus on Dock)
Ctrl-F5 (Focus on toolbar)
Ctrl-F6 (Focus on palette)

There are also shortcuts for F4 and F7 but I have not found much use for them.

Title Bar Tricks in OS X

drilldownStandard OS X title bars have several hidden features that can be very helpful. If you hold the command key and click the title of a window1 you will get a menu that allows you to drill down through the hierarchy to the root of the filesystem.

However, that’s not the only useful trick you can perform. If you have a document open in an application you can click on the icon in the title bar and, after holding for a brief second until the icon darkens to indicate it has been selected, drag it. This acts as a standard drag/drop but without having to go locate the file in the Finder! For example, you can save a document in TextMate, Excel, or Word and then drag/drop to Mail or Entourage and it will open a new email message with the document already attached.

  1. This works in the Finder, Word, Excel, TextMate, et cetera. Essentially any open window that represents a document on your filesystem.

Spelling Suggestions In OS X

suggestionsOne of the lesser known OS X niceties is the ability to get spelling suggestions/completions from any standard Cocoa text input. To accomplish this, simply hit the Escape key1) in any supported application (iChat, Mail, and TextEdit are some examples) and be amazed. I find this feature very useful for quickly obtaining the correct spelling of a word without taking your hands off the keyboard to get a correction. Sadly, many applications use their own text handling for various reasons so this won’t work universally (Word, TextMate, et cetera).

  1. In some cases Escape already has a bound behavior. For these situations pressing Option-Escape may give the expected dropdown. For example, in Adium the Escape key will clear your entry, but if you hit Option-Escape you will get the completion dropdown.

RAM Disks in OS X

If you’ve ever wanted to set up a ramdisk in Mac OS X, here’s a quick script you can use. Simply invoke it with a size in MB and the name for your volume and it will create and automount it for you. It also won’t leave any dangling directories in your /Volumes/ when you eject it! Be sure to chmod the file you place the script in to make it executable (755 or likewise).

#!/bin/bash
if [ -n "$3" ]; then NUM_ARG=ERR; fi
if [ -z "$1" ]; then NUM_ARG=ERR; fi
 
if [ -n "$NUM_ARG" ];
then
echo 'Usage: ./ramdisk <size in MB> <name, optional>'
exit
fi
SIZE=$1
NAME='my_ramdisk'
let "SIZE *= 2048"
if [ -n "$2" ]; then NAME=$2; fi
diskutil erasevolume HFS+ "$NAME" `hdiutil attach -nomount ram://${SIZE}`
echo 'Done'