Monday, March 1, 2010

In Depth: How to detox and spring clean your Mac

In Depth: How to detox and spring clean your Mac: "

Tired? Sluggish? Lost your get-up-and-go? Yes, Mac, we're talking to you! You used to be so fresh and sprightly. But you've been working long hours and not looking after yourself, and now you can't seem to do things as quickly as you used to.

Like the journalist's liver, one organ in the Apple corpus is particularly susceptible to deterioration: the hard disk. While just about everything else inside a computer is an immobile slab of semiconductors, the hard disk is a big box of spinning plates with the mechanical sophistication of a 1985 Austin Maestro.

And it has, like Peter Mandelson, more jobs than it probably ought to. Most of its time is spent picking up after RAM, catching whatever falls out as apps are flicked between and documents are worked on. Exhausting as it is, this is a mere hobby.

Its primary function is to store all your stuff. At this it excels, providing the kind of wide open digital spaces that, however many images you shot with your camera, would happily… hang on, it says here it's full!

What's filling up your hard disk and RAM, and distracting the attention of your CPU? How do you find the culprits, and is it safe to remove them? Can you make more room?

Step this way for solutions to all these problems, and a lot more besides.

Seek out excess baggage and slim down your OS X installation

Your Mac's hard disk has a hard life. Not only is it the permanent repository for all your applications, documents, music and movies, it also houses the operating system that makes everything work, while serving as temporary storage space for whatever you're busy with.

Little wonder, then, that when the drive gets clogged, your whole system suffers. The smaller your disk, the more likely you are to have problems – but even big ones can fill up. The amount of free space available on the current disk is shown by default at the foot of each Finder window.

As a rule of thumb, you should keep at least 10% of your main hard disk (the 'startup disk') empty so that it can run efficiently. Bear in mind that some of your hard disk is taken up by Mac OS X's virtual memory swap file, where it stores data needed by the currently running apps that won't fit into your Mac's actual memory (RAM).

These days, that typically runs to tens of megabytes. So on a Mac with a 250GB drive, say, you can expect to store well under 200GB of your own data before hitting the buffers.

A full hard disk has a number of consequences. If it's really, really full, you'll start seeing messages such as 'Your startup disk is almost full', or warnings that something can't continue until you make some space.

In other cases you may not get an alert, but things you're expecting to happen just don't. This is because apps are trying and failing to store temporary data on the hard disk – which is generally the only place they can put it.

A nearly full hard disk also makes it harder to read and write files, and since your Mac is constantly swapping data between RAM and 'virtual memory' on the disk, that inefficiency can make everything a little bit slower and less responsive.

Space invaders

Clearing out your hard disk begins with working out which files you don't need. It's largely pointless opening each folder in turn and flicking through it for anything that looks unnecessary; you could delete hundreds of files without making any significant impact.

The trick is to focus on big files. Chucking out one video clip could save more space than sifting through all the text files you've ever saved.

Use Spotlight to find large files wherever they may be lurking. In the Finder, press Command+F for a search window. At the top-left, set the first drop-down menu to Size (you may have to go via Other) and the second to is greater than, then set the size to, say, 50MB. Let Spotlight do its work for a minute or two and you'll know which files are taking up substantial space.

Click a file within the search window to reveal its location in the status bar below, and press Command+Delete if you want to trash it.

Unfortunately, Spotlight isn't as helpful as it could be. File sizes aren't listed in the search window, and you can't sort by size; you have to use Command+I (Get Info) on each file to see its details. Annoyingly, searching by size only finds files, not folders, so you may spot a 60MB Photoshop file but miss a folder of 60 1MB images that are equally redundant.

For a more complete picture, there are third-party utilities. GrandPerspective, free to download, uses colour coding to reveal what kinds of files are hogging your hard disk, as does Disk Inventory X.

Grand perspectives

More informative is WhatSize, which costs $12.99 (just under £8) but has a free demo version to try on folders up to 20GB. DaisyDisk is pricier at $19.95 (about £12) but free to try for 15 days.

Need to know

When hunting for deletable files, watch out for large anonymous-looking files that you may not recognise but do, in fact, need.

A classic example is if you use the Entourage email client that comes with Microsoft Office. And, as if to illustrate the proverb about eggs and baskets, it stores all your messages in a single file, called Database.

This lives in ~Documents/ Microsoft User Data/Office 2008 Identities/Main Identity, and can get rather unwieldy: one of ours currently stands at 14GB. Obviously you can't just delete this, but you can hold the Option key while starting Entourage and take the option to compress your database.

Among the more expendable data likely to be lurking are the disk images (DMGs) that you download to install new applications. Once you've installed the app, you don't need the disk image any more. It's only your registration details that you really need to keep. So you might want to do a Spotlight search for .dmg and bin what you find.

Mac OS X itself comes with various files that may not be relevant to you, and as long as you're careful you can get rid of some of these. For example, in /Library/Printers you'll find folders full of printer drivers and help files for all the major manufacturers. You can always get the software for a new printer from the manufacturer's website or the driver CD.

Another sizeable chunk is taken up by files for the many different languages that the Mac OS supports. You can safely delete the ones you don't use with Monolingual. Similar options are available within utilities such as WhatSize.

Monolingual

Cut out what you don't need, consolidate what you do

The first rule of deleting unwanted files is not to delete them until you're quite sure they're unwanted. It's all too easy to get carried away and bin everything that takes up more than 5K and doesn't immediately strike you as essential. This is a recipe for calamity.

Of course, the Mac has its own way of saving you from yourself, known as the Trash. Remember that trashing a file – whether by dragging it to the Trash, right-clicking it and choosing Move to Trash, or selecting it and pressing Command+Delete – doesn't actually erase it: open the Trash and it's still there, until you hold the mouse button down on the Trash icon and choose Empty Trash, at which point everything within it is erased from the disk forever.

It's only then that, having binned a number of unwanted files, you'll see an increase in available disk space. This makes it tempting to empty the Trash immediately after dragging a file to it to check the effect on your disk usage, but resist this if you can: the longer you leave deleted files in limbo, the better the chance of realising before it's too late if you still need them.

But maybe your hard disk is full of files that you do still need. In that case, rather than erasing them you just need to move them. The best place for them to go is usually an external hard disk. These are quite affordable, starting at around £75 for 500GB, and work at pretty much the same speed as your main hard disk, so there's no disadvantage in using them even to store files you use regularly.

HDD

Simply plug the drive in, drag all the files across that you want to store on it, wait for the copy to complete, then delete them from your main hard disk – and remember to empty the Trash.

Just don't try moving applications or system files across, as these need to live on your startup disk.

To move your iTunes Library, follow the instructions here. If you use the Time Machine backup system (included with Mac OS X 10.5 Leopard and higher), it's best to avoid storing other files on the drive you use for Time Machine, partly because they won't get backed up and partly because there's no way to tell Time Machine how much of the drive to leave free, so you'll end up fighting with it for space.

But Time Machine will coexist quite happily with another external drive and keep its contents backed up, as long as your Time Machine drive isn't significantly smaller than the total of your other drives.

Alternative storage

With a MacBook, keeping an external hard disk attached isn't so practical, although some neat portable models are available. But you might still be able to identify sets of files that you don't need every day, such as a collection of your previous work, and move these to a desktop drive – or to another Mac with a roomier hard disk – from which you can access them when needed.

Files that you only rarely need, or are keeping because you're obliged to but will probably never use, could be moved to DVD instead; spending a few minutes burning 4.5GB of data is worth it to free up 4.5GB of disk space.

Another option is online storage. The easiest way is to use your iDisk, if you subscribe to Apple's MobileMe; since this is constantly accessible in the Finder, you can copy files to and from it at will – though watch out not only for the 20GB storage limit, but also, if you'll use these files a lot, the 200GB/month data transfer cap; you can double these for an extra £30 a year.

Alternatively, if you have some server space, perhaps from your broadband ISP or as part of a web hosting plan, you should be able to access it via FTP, either by pressing Command+K in the Finder and typing an address beginning ftp:// or using an FTP utility such as Transmit 3 ($29.95, about £18, or free to try).

You'll need the appropriate username and password from your service provider. On most broadband connections, uploading your files will be fairly slow work, but you can then download them when needed at the full speed of your connection, so it can be reasonably convenient – and of course you can access this data from different Macs and locations too.

When archiving files – that is, copying them to other media and then deleting them from your Mac – always remember you're not 'making a backup'. A backup is a second copy. If that data is really important to you, make two copies, in different places, before you choose to trash the original files.

Invisible enemies

Aside from the files that you can see are taking up space on your hard disk, you might wonder about files that you can't see. There certainly are plenty of these around on your Mac, including system caches, which automatically store regularly used data to help make Mac OS X and your applications run more efficiently.

Various utility programs offer to 'clean' your caches, including OnyX and Cocktail ($14.95, or £9). This may help to avoid caches becoming bloated over time.

Onyx

Don't assume, however, that deleting caches will necessarily serve the purpose of freeing up disk space and streamlining your Mac. Caches aren't a bad thing; the system uses them to improve performance, and in any case, if you delete them, they'll simply be recreated next time you restart your Mac or switch user accounts.

So cache cleaning isn't a panacea, and it's generally fair to say that if Mac OS X is hiding something from you, you should probably take the hint and leave it alone, unless you have reason to believe it's causing a problem.

Reclaim disk space, one application at a time

Removing applications from your Mac won't usually have any direct effect on its performance or reliability, because apps don't do anything until you run them. But there are a few exceptions, and deleting large applications can certainly free up some disk space.

In most cases, it's easy to get rid of an app you don't need any more. Just drag its icon from the Applications folder to the Trash. Goodbye, app. (Dragging the icon off the Dock, on the other hand, doesn't delete anything; it just means the icon won't appear here in future, except while the app is running.)

There are a couple of reasons for us to look at uninstalling in a bit more detail, though. One is for the benefit of anyone who's switched to the Mac from Windows.

There's a good reason why Windows comes with an uninstall utility in its control panel. When you install a Windows app, not only does it add several kinds of files in different places, it also updates the Windows Registry – essentially a big list of all the stuff that's installed on your PC. The Registry is notoriously prone to getting so messed up that your system grinds to a halt.

Even when you correctly use Add/Remove Programs to manage your apps, rather than trying to install or erase them manually, things can still go wrong – and over time they almost invariably do. Mac OS X has no Registry to worry about, and handles apps with a lot less hassle. Even so, deleting an app's main file (which, as we'll see, isn't exactly a file at all) doesn't always remove it and its effects from your Mac.

Package deal

When you open the Applications folder and find the icon that you'd double-click to run a particular app, what you're seeing is a 'package' (also known as a 'bundle') that looks like one file but in fact contains several. Its Kind is listed as Application, and if you hit Command+I to Get info you'll see its file extension app.

In many cases, everything the app needs can be stored within this package, which is nice and neat. All the Apple iLife apps work this way. To see what's inside the bundle, right-click it (or Ctrl-click with a single-button mouse) and choose Show Package Contents.

Removing apps

You'll first see, tautologically, a folder labelled Contents. Within this are various subfolders, such as Frameworks and MacOS. Open these in turn, and you'll see a whole load of stuff that probably means absolutely nothing to you. But you get the idea.

It's fun to have a look in Resources, because it houses a lot of the icons and user interface graphics used within the app. You can open these in Preview or Photoshop, and you could even customise the app by editing them, but this isn't quite as straightforward as it looks (icons are accompanied by masks, for example, that need editing to match).

As far as uninstalling is concerned, dragging the application to the Trash will delete all of these bits and pieces. Some apps, however, come with additional resources – such as plug-in folders and PDF user guides – that won't go inside a package. These are generally contained in an ordinary folder along with the .app.

For example, Adobe Photoshop CS4 lives in a folder called Adobe Photoshop CS4. To delete such apps, you need to drag the whole folder to the Trash. Check first that it doesn't contain anything you might want to keep.

If you're removing the app because you've installed a new version, you may be able to transfer plug-ins, custom settings and so on. This is usually just a matter of copying them to the same-named subfolder within the new app's folder.

It's worth checking on the maker's website whether existing plug-ins will be compatible with the new version, and for obvious reasons you should take care not to replace new plug-ins with older ones. Always run your new app 'clean' before transferring any existing plug-ins or settings, so you'll know what's to blame if it crashes or behaves oddly after you add them.

If it does, remove them all, perhaps to a new folder somewhere else on your Mac, and add them back one at a time, quitting and relaunching the app, to identify what's causing the problem. Similarly, if you're deleting a game from an old Mac because you're now using it on a new one, you may want to copy across your saved games.

In any event, it's wise to leave the Trash unemptied for a little while after binning an app, so that if you discover you're missing something you can rescue it. (Regular Time Machine users will have this ability regardless, of course.)

Bits and bobs

Beyond the files in their packages and folders, most apps also store a couple of other data files on your Mac. Preference files, with the extension .plist, live in /Library/Preferences, or the equivalent inside your home folder (check both), and contain user settings.

It's usually pretty obvious which preference files belong to which app, but if that's too fiddly for your liking, AppTrap is a free utility that automatically offers to remove the appropriate preference files whenever you trash an app. Then again, these files are usually tiny and carry practically no risk of causing errors, so arguably you might as well leave them alone.

Some apps have additional support files that may be much heftier. These generally live in /Library/Application Support, or the equivalent inside your home folder, and may be named after either the app or its maker.

Think twice before deleting items that may be used by more than one app. Finding all the related files for a given app may take a bit of lateral thinking: GarageBand, for example, keeps around 250MB of audio samples in /Library/Audio/Apple Loops/Apple/Apple Loops – so they're well worth removing if music-making isn't your thing.

Kill memory leeches, discover hidden processes and more

You've chucked out the excess baggage from your Mac, but to get it moving as fast as possible you may also need to scrape off some barnacles. While it's good to prevent unnecessary files filling up your hard disk, the contents of your Mac's memory will have a more direct impact on performance and reliability.

Mac OS X comes with a tool to reveal what's going on in your system memory moment by moment. It's called Activity Monitor, and is found in Utilities within your Applications folder.

Run it and, in the drop-down menu at the top, choose All Processes. This way you'll see everything that's running, as opposed to My Processes, which only covers what belongs to your user account. In the listing below, under Process Name, you'll see all the applications that are currently running, with their familiar icons.

Along with these will be lots of other stuff you don't recognise at all. Much of it will be integral to the operating system, but you may be able to spot non-essential OS X and third-party processes that you can do without.

The first column to look at is CPU: this shows how much of your Mac's processor time is being taken up, right now, by each process. (Click the CPU tab at the bottom to see the total that remains 'idle' – in effect, the processing capacity available for the next thing you try to do.) Anything above zero is worth looking at.

For example, you're quite likely to find that your favourite web browser is merrily eating up processor cycles, to the tune of 10% or more, even when you're not using it. You can free up this processing power just by closing the browser windows you've left open. When an app is running but not currently doing anything, it should normally use no processing power; it's the exceptions you're looking for.

Besides the apps youve deliberately launched, CPU time may also be taken up by programs that load by default whenever you start your Mac: check your Login Items (in System Preferences > Accounts, as mentioned earlier) and compare the names against the active processes. Some items wont show a Dock icon or any other visible indication that they exist, which is why Activity Monitor is so useful for spotting them.

Identity parade

How can you tell what the more obscure processes are and whether they're essential? If you don't recognise an item's name, do a Google search for it – you'll very often find out what it is. Some processes belong to apps: for example, Adobe Creative Suite apps use something called FNPLicensingServ to manage their licensing.

It's easier to identify these processes if you set Activity Monitor's listing to All Processes, Hierarchically, so each process appears below its parent. Don't interfere with a process that belongs to an app, or you'll probably crash the app.

Having identified a process you want to kill, just click it and click the Quit Process icon at the top-left, then choose Quit, and if that fails, Force Quit.

It makes sense to force quit any process that's highlighted in red, because it's stopped responding – crashed, in plain English – and is using memory and processor time to no purpose.

First, though, go to View > Send Signal to Process and try Interrupt – this just might jolt an app out of its stupor.

When any process fails to quit on request, send a Hangup or Kill signal in the same way to make it stop. If that still doesn't work, note its PID (on the left), then run Terminal (found in /Applications/ Utilities) and type kill followed by the PID. Press Return.

Remember, these are last resorts: try quitting apps normally first to avoid losing any work. Note that you can click any of the headings in Activity Monitors table to sort by that criterion. Sorting by CPU usage may not work because the figures change too fast; it may help to select View > Update Frequency > Less often.

Sorting by process ID can be useful because higher numbers are allocated to more recently started processes, so if your Mac has just begun to crawl you know which are the likely suspects. Also note the Kind heading at the far right.

If you have an Intel Mac, any app that shows anything but 'Intel' in this column is an old PowerPC program relying on Mac OS X's Rosetta emulation technology. That will tend to use more memory and CPU time. If there's a native Intel version available, consider upgrading.

At the foot of the Activity Monitor window, the System Memory tab is worth a look. As we saw earlier, VM size is the amount of hard disk space currently reserved for virtual memory, which may be gulp-inducingly large.

Active plus Inactive represents the data that your Mac is juggling between RAM and virtual memory to keep everything running, while Wired is the core data that has to be stored in RAM to keep the current apps running.

The pie chart on the right represents your RAM; ideally, there should be plenty of blue and green as well as red and yellow. If it's very red, think about installing more RAM (or running fewer apps at once).

Keeping fit

Activity Monitor is a bit unwieldy as an at-a-glance indicator of performance, but a very good third-party tool for that purpose is iStat Menus, which is free. This shows CPU, disk and memory indicators in your main menu bar that reveal more detail with one click, letting you keep an eye on your system at all times.

iStat menus

Finally, utilities such as OnyX and Cocktail promise performance improvements by de-cluttering various aspects of your system. They're worth a try, as long as you note the possible consequences of each action.

Cocktail

Many users swear by them, and they can come in handy to troubleshoot niggles or spring-clean your system when it feels sluggish, but we're not convinced you need to use them regularly. After all, Macs are designed to run smoothly by themselves, and most of the time that's exactly what they do.



"



(Via TechRadar: All latest feeds.)

No comments: