Skip to content

Instantly share code, notes, and snippets.

View rufferto's full-sized avatar

Barry Wilson rufferto

View GitHub Profile
@rufferto
rufferto / gist:5424520
Last active December 16, 2015 10:59
Add and delete global login items for Mac 10.6+. ARC code. C routines.
#import <ApplicationServices/ApplicationServices.h>
void addLoginItem(NSURL *appURL)
{
AuthorizationItem right[1] = {{"system.global-login-items.", 0, NULL, 0}};
AuthorizationRights setOfRights = {1, right};
AuthorizationRef auth = NULL;
AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);