At your service: Services menus

Like many other parts of the macOS human interface, its Services menus are heavily used by some users, and ignored by others. Recent problems with unavailability of Services in Preview have caused cries of anguish from many users, but others hadn’t even opened that menu for many months.

For some, the Services menu is a chaotic mess of unwanted features, which seems beyond their control. It includes commands which they’d never want in a month of Sundays, and offers access to apps which they only use once in a blue moon.

After a couple of minutes, though, their Services menu could be far briefer and more purposeful, and something that is of everyday practical use: want to open that file in BBEdit rather than TextEdit? Two-finger tap for the Finder’s contextual menu, and select Open File in BBEdit.

services02

How Services get listed

There are two types of service which can appear in the Services menus: those in purpose-built .service bundles in the Services folder in any of your Library folders, and those identified by apps (and other software) which are typically in the main /Applications folder. We don’t often look in those Services folders, but a few apps install bundles there to improve access to their services.

There is an advantage to separate .service bundles in Services folders. The list of available services, kept in ~/Library/Preferences/com.apple.ServicesMenu.Services.plist, is maintained by an ancient tool pbs, which at one time on NeXTStep used to be responsible for the pasteboard and several other things, but now just looks after the Services service. pbs may not notice Services items offered directly by an app in /Applications for a little while, but it is much quicker at picking up .service bundles in the standard Service folders.

Either way, services can specify a lot of settings which determine the context in which they become available. These include different service categories, the type of information they handle (such as a list of filenames, rich text, or specific image types), and the apps in which they can be used, such as the Finder. Services can also offer a range of language localisations as they wish.

pbs gathers all that information from individual Info.plist files in .service bundles in the Services folders, and from known apps, and compiles the list of all available services in ~/Library/Preferences/com.apple.ServicesMenu.Services.plist

If you know of available services which are not appearing in the Services menus when they should, the best place to look for them is not in that property list, but to dump it to a text file using pbs, in a command like
/System/Library/CoreServices/pbs -dump_pboard > servicesdump.text
You can then browse that text file and see whether the service is being recognised properly.

If a service is missing, you can get pbs to rescan it by logging out and back in (or restarting), then opening any item in a Services menu. If that doesn’t do the trick, try the command
/System/Library/CoreServices/pbs -flush
and then use a command in a Services menu. The resulting rescan will take a while, but should create a brand new list of services.

Preparing Services

A lot of apps offer all sorts of services which you would probably never dream of using. When you have too many items in a Services menu, it becomes ungainly, so before you start using it you should open the Keyboard pane, select its Shortcuts tab, then the Services item at the left. There’s also a shortcut to this at the foot of the main Services menu.

This shows all the available services across eight different categories, from Pictures to General, and you should work through each selecting only the services you want to retain in the Services menus.

services03

Fixing broken Services

Sometimes you’ll come across apps which don’t offer good Services menus themselves, a problem with recent versions of Preview, and services which don’t work properly in one way or another.

There is absolutely nothing that you can do to alter the way an app handles its Services menu, or the services which it offers in different contexts. Those are determined by the app’s code and settings, so if they’re wrong, all you can do is complain to the developer.

Apps and .service bundles which offer services keep settings in their Info.plist file, which you could in theory edit. Unfortunately doing so breaks the bundle’s signature, and rules that out. You can’t meddle with the pbs data, and because those are compiled from Info.plist files, this is not something that a developer can expose in user preferences. Again, all you can do is complain to the developer, and hope that they will fix it for you.

It really is worth spending those few minutes setting up your Services menus carefully. Once done, they will save you a lot of time and effort by putting powerful commands on (double) tap, where you most need them.