OSX Service Example

1 min read osx, macos, objective-c

Sample Mac OS X Service

Example Mac OS X service as described in Apple’s Services Implementation Guide

This is built as standard osx .app from an Xcode Cocoa app project. The Info.plist is modified to make it a service and it’s product, MacTestApp03.app, is copied to the ~/Library/Services directory

Install

Copy this .app build product to ~/Library/Services

Run the following from Terminal to reload all services

/System/Library/CoreServices/pbs -dump_pboard

Open TextEdit. Highlight text. Visit TextEdit | Services | My Test Service 02. A sound will play

Technical Details

Refer to Info.plist NSServices key

Notes

There are two ways to implement a service. This example as a .app and also as a standalone .service bundle. Please see Writing a .service bundle post for details on a .service bundle.