Search code examples
macosbashunixosx-elcapitanlaunch-agent

Using LaunchAgents in El Capitan (10.11)


I have a series of scripts that run at the load of one standard user, one admin user and the Default User Template. For this particular example, they configure the background and the screensaver (since those are ByHost preferences that can't effectively be built into an image.)

However, with /sbin/ no longer accessible in 10.11, my scripts have all failed. When changing them to run from my Admin Files folder, they still aren't doing anything at all.

Here's the command that usually goes in /sbin/

#!/bin/sh

## Admin Platform Services User Customization Script - Default User Desktop - (Version 7.0 - Twilight Sparkle) B
## 7.1 (Late 2015) 10.10 Version - Updated with new directory structure and script 
## Single-Run Script to Change the Default User's Background

## Force background for Default User
/Admin-Files/Cosmetic\ Scripts/Background\ Engine/ChangeDesktop.py --path /Admin-Files/Admin\ Backgrounds/7.0\ Default\ User\ Backgrounds/OSX10\ -\ Geblin\ Mekkatorque\ -\ Default\ Large.png 

## Removes the .plist LaunchAgent from inside the User Launch Agent Folder. 
rm -f ~/Library/LaunchAgents/set-user-bg-osx10.plist

The PLIST is here:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>set-user-bg-osx10</string>
   <key>Program</key>
   <string>/Admin-Files/Scripts/Scripts/OSX10/set-user-bg-osx10</string>
   <key>RunAtLoad</key>
   <true/>
</dict>
</plist>

Now simply nothing happens. This did work in a previous beta of OSX11, but no longer works in the GM.

Oh one more thing: the permissions:

chmod 444 /Blizzard-Files/Scripts/Scripts/OSX10/set-user-bg-osx10.plist 
chmod +X /Blizzard-Files/Scripts/Scripts/OSX10/set-user-bg-osx10

Solution

  • If anyone comes across an issue like this, the solution is insanely simple.

    Change /sbin/ to private/etc/

    And then it works like a charm.