X

Tutorial: Getting into Login Items: Part 2

Tutorial: Getting into Login Items: Part 2

CNET staff
9 min read

Ted Landau
September 2005

Your list of Login Items can be seen by selecting the Login Items tab for your account, as accessed via the Accounts System Preferences pane. Last month, in Part 1 of this two-part tutorial, we covered the basics of working with Login Items: what they are, how they work and why to use them. In Part 2, we explore some more ?in-depth? and troubleshooting-related aspects of Login Items.

Q. In my Login Items list, one or more items have a Kind of ?Unknown.? Is this a problem and, if it is, how do I fix it?

This is indeed a problem that you should fix. It means that Mac OS X can no longer locate the ?unknown? Login Item and so it is not loading at login, despite the fact that its name is still in the list.

This can happen for several reasons. The most common reasons are: (a) you deleted the named application or the software package that contained the named application, or (b) you moved the relevant software to a new folder.

In the former case, the solution is simply to delete the item from the Login Items list. In the latter case, you are more likely to want to re-add it. Details for how to delete and re-add Login Items were given in Part 1 of this tutorial.

Q. Where does Mac OS X actually store the data that contains the list of Login Items and their locations?

So where exactly does Mac OS X store the data that it uses to create the Login Items list? It is stored in a preferences (.plist) file called loginwindow.plist, located in the ~/Library/Preferences folder (i.e., in your Home directory). Note: This is a separate file from the com.apple.loginwindow.plist file, also in the same folder.

To see the listing for each item, open the .plist file with a utility such as Property List Editor (installed as part of the optional Xcode/Developer software included on the Mac OS X Tiger DVD) or a third party utility such as PlistEdit Pro. With Property List Editor, click the disclosure triangle next to the word Root and again next to AutoLaunchedApplicationDictionary. This will reveal a list of numbers, starting with zero (0), one for each Login Item (see Figure 1). If you click the disclosure triangle for any of these numbers, several sub-properties appear. One of these properties will be Path; the value of this property will be the path to the specified Login Item; the name of the item to be launched is at the end of the path.

Note: These paths are not updated if you move the location of an item in the Finder after it has been added to the list. That is why, as covered in the previous question, the Kind of a listed item changes to Unknown if you move the location of the item.

{Figure 1: A loginwindow.plist file, with the path to LaunchBar shown in the Value column of the Path property.}

Q. I suspect I have a conflict with one of my Login Items. How do I find out if my suspicions are correct?

A conflict can result in a number of different symptoms. For example, a Login Item could cause an otherwise unrelated application to crash. Or a Login Item conflict could prevent a successful login, blocking you from accessing your account at all!

If you are unsure if a Login Item is the cause of a symptom, your first step should be to login with Login Items disabled. If the problem vanishes when you do this, you can assume you have a Login Items conflict.

To do this, if you are currently logged in to your account, simply Log Out (via the command in the Apple menu). When the Login window appears, enter your name and password. Then, hold down the Shift key when you click the ?Log in? button. Continue to hold it until the Desktop appears. No Login Items will load.

You can also do this when you first startup your Mac and the Login window appears. Doing it at this time is almost essential if a potential conflict is preventing your from logging in to your account.

But what if you have selected to automatically log in at startup, so that the Login window doesn?t appear at startup? Don?t despair, there are several work-arounds. Here is a relatively easy one:

  1. Restart your Mac.

  2. Once the blue screen appears, hold down the Shift key. Continue to hold it until the Login window appears. It will do so even if you have selected to automatically log in. Just be careful not to hold down the Shift key earlier than the blue screen, or you may initiate a Safe Boot (which does much more than simply disable Login Items). You can tell if you did a Safe Boot because the words ?Safe Boot? appear in the Login window.

  3. Release the Shift key. Enter your name and password. Hold down the Shift key again and click the ?Log-In? button, as just described.

Q. I?ve determined that I have a Login Items conflict. How do I figure out which specific item is the culprit?

Those of you who recall the days of Mac OS 9 probably remember a wonderful utility called Conflict Catcher. It removed the tedium of using trial-and-error to determine the cause of an extensions conflict. It would be great if a comparable utility existed for diagnosing Login Items conflicts in Mac OS X. But, as far as I know, there is not one.

On the bright side, Login Items conflicts are much more rare than extensions conflicts in Mac OS 9, so you wouldn't need to use the Mac OS X utility as often.

In the absence of a utility to help out, the simplest approach, assuming you don?t have too many Login Items, is to remove items from the list one at a time, logging in after each removal, until the problem goes away. When it does, you can assume that the last removed item is the culprit (or at least a co-conspirator!).

Once you have identified the troublesome item, your next step will be to re-add all the items you deleted along the way and that are presumably OK. A potential issue here is that you may not recall the names of all the items you deleted. Even worse, you may have no idea where some of the deleted items are located, making it hard to re-add them (as covered more in Part 1 of this tutorial).

One solution to this dilemma is to create a copy of the aforementioned loginwindow.plist file before you begin deleting items from the list in the Accounts System Preferences pane. Save the copy to your Desktop. This provides you with a list of all of your originally installed Login Items and the path to their locations. You can use this information to recall and locate deleted items later on when you want to re-add them.

To speed this process along (by eliminating some typing), try the following:

  1. With the loginwindow.plist file opened, double-click a desired path (in the Values column) and select/copy all but the last section (the one that contains the name of the item) of the path.

  2. Go to Login Items list window (in Accounts System Preferences pane) and click the Add ( ) button.

  3. Type Command-Shift-G. This brings up the Go to Folder window.

  4. Paste the copied text into the text box and click Go. This will take you directly to the location needed to select and re-add the Login Item.

  5. Select the item and click the Add button.

  6. Repeat Steps 1-5 for additional Login Items, as needed.

Having done all this, what do you finally do about the offending Login Item? The easiest solution is to leave it alone at this point. That is, don?t put it back on the list. If it is important that it be a Login Item, contact the developers of the conflicting item(s) to inform them of the conflict and find out if they have released (or intend to release) an updated version that addresses the issue.

Q. Can I re-order the order in which Login Items load?

Suppose it turned out that a Login Items conflict occurred if Item B loaded before Item A but not vice versa. The solution would be to reorder the load order so that Item A loads first. On the assumption that load order is determined by the order in which the items appear in the Login Items list, you could presumably accomplish this by click-dragging Item A and moving it above Item B in the list.

And everything did appear to work pretty much this way prior to Tiger. In Tiger, attempts to click-drag an item to a new location have no effect. Attempts simply select multiple items in the list rather than dragging anything. I did find one exception, but it was not of much help: If you click-hold on the right side of an item?s listing (to the right of where its Kind is listed), you can drag the item. But the result of the drag is that the item is deleted from the list as soon as you let go?rather than moved to the dragged location!

While this drag-delete is probably a bug, the general inability to re-arrange items appears to be intentional. The reason is that (as cited on several threads in Apple?s Discussion boards - although not officially confirmed by Apple) Login Items now load asynchronously (this started in Panther). In brief, this means that Login Item #2 will launch immediately after Login Item #1 has launched, even if #1 has not yet completed its launch (and so on for other items). This is similar to what happens if you click several items in succession from the Dock. They all seem to be launching at once. Depending on what the items are, Item #2 may actually finish launching before Item #1. The end result is that the load order becomes largely irrelevant.

Despite all this, if you still want to control the listed load order of your Login Items (perhaps because Item #2 needs information from Item #1 in order to launch successfully and the correct load order at least gives this a chance of happening), you do have a few options. These include:

  • Bypass using Login Items at all - except for a single Automator workflow application. Have the Automator workflow set up to launch the desired items in the order you wish. Using the Finder?s Launch Application action in Automator should make this easy to do.

  • You can delete and re-add items in the Login Items list. Added items appear as the last item in the list, allowing for a crude but effective method of re-ordering items.

Q. Can I have a "universal" list of Login Items that loads regardless of the user who is logging in?

Suppose you have five people who share the use of your Mac. As the administrator of the Mac, you have a list of items that you would like launched at login for all users. You could accomplish this by successively logging in to each user's account and adding the desired items to their Login Items list . But this has two disadvantages: (a) it can be time-consuming and tedious to do and (b) each user could later delete the items you added. A better solution would be to have a single list that would affect all users, and that only an administrator could modify. Can this be done? Yes.

One way is to use the loginwindow.plist file that is located in the root level /Library/Preferences folder?or create one there if it does not exist. Following the format of the loginwindow.plist file in your Home directory (as shown in Figure 1), add the desired properties. Note: Either do not include the AliasData fields or give them a value of 0; items will load without this field.

However, even this is not a perfect solution, as these items only run at the initial login at startup. If a user logs out and logs back in again, or another user logs in via Fast User Switching, the items in this list will not load again. That's why a better solution is to use the new launchd feature in Tiger. You could, for example, create a LaunchAgent file (stored in /Library/LaunchAgents) for each item you want to launch. These are .plist files, although with a different format than the loginwindow.plist file. These launch at every login. Although not all that difficult to do, how to create these files gets beyond the scope of the Login Items topic and the intended level of these tutorials. If you are interested, you can learn more about launchd from these two Apple documents: Getting Started with launchd and Introduction to System Startup Programming Topics.

Like what you've found in this tutorial? Get more troubleshooting guidance (updated daily) by subscribing to MacFixIt Pro.

Resources

  • More from Tutorials