2

I am running El Capitan on several computers and would like to be able to use at to run scheduled jobs in the background. Enabling at requires editing /System/Library/LaunchDaemon/com.apple.atrun.plist. Any way I have tried to do this, I have run into a permissions problem: using sudo, logging in as root or trying to change the permissions from the file information panel all result on a permissions error of some sort.

I have tried:

  1. sudo vi /System/Library/LaunchDaemon/com.apple.atrun.plist and not been able to save the edited file.
  2. Copying to file, editing it and copying back - I am not allowed to copy back using sudo.
  3. Using Xcode to edited the fiel through a GUI, cannot save.
  4. using Property List Editor, cannot save, even logged in as root.
  5. Changing owner, group is not allowed, even using sudo or logged in a root.
  6. Changing permissions of all the subdirectories in the tree above (System, System/Library, etc.) used sudo, also tried changed disk permissions.
  7. Run disk utility.

There must be some way of doing this, please advise.

2 Answers 2

3

The file com.apple.atrun.plist is protected by System Integrity Protection.

So boot to the Recovery HD partition (hold down Command + R while restarting), disable SIP and modify the item:

  1. In the menubar open Utilities->Terminal
  2. Enter csrutil disable
  3. Reboot to your main volume and edit the file
  4. Reboot into the Recovery Partition again
  5. Enable SIP again csrutil enable
  6. Reboot to your main volume
1
  • The answer given by @klanomath is correct, but further action is required in Mojave (10.14). SIP has been taken a step further to Transparency Consent and Control (TCC). In short, you must explicitly grant full disk access to atrun: 1. Go to System Preferences->Security & Privacy. 2. Select Full Disk Access and click the padlock icon to make changes. 3. Click the + icon below the box on the right and add atrun. The path to atrun is /usr/libexec/atrun. Select your root drive (probably something like 'Macintosh HD') and press Command+Shift+..
    – Flic
    Nov 13, 2018 at 22:19
1

Using 10.11.6 (El Capitan) I was able to get atrun to run following the instructions found in the article "Using at for command scheduling under Mac OS X".

To enable atrun, execute,

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist

To disable atrun, execute,

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.atrun.plist

The article has additional useful information about atrun and at commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .