1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

com.apple.batteryd.plist removal Question

Discussion in 'MacBook Air' started by Quad5Ny, Jan 22, 2011.

  1. Quad5Ny, Jan 22, 2011
    Last edited: Jan 22, 2011

    macrumors 6502a

    #1
    I have a new MacBook Air and it came shipped with a bogus plist (com.apple.batteryd) that had launchd going nuts. Launchd was trying to run /usr/local/libexec/batteryd every 10 seconds, stopping the computer from sleeping and spamming the system log.

    Edit: For reference, this was what was being spamed in the system log every 10 seconds:
    Code:
    1/13/11 11:09:31 PM com.apple.launchd[1] (com.apple.batteryd[1114]) Exited with exit code: 1
    1/13/11 11:09:31 PM com.apple.launchd[1] (com.apple.batteryd) Throttling respawn: Will start in 10 seconds
    1/13/11 11:09:41 PM com.apple.launchd[1] (com.apple.batteryd[1115]) posix_spawn("/usr/local/libexec/batteryd", ...): No such file or directory
    So I went into Terminal and typed ' sudo rm "/System/Library/LaunchDaemons/com.apple.batteryd.plist" ' and everything is as it should be, but I just noticed Apple released a update that's meant to fix this. - http://support.apple.com/kb/DL1354 (Which is weird because the update is for 10.6.5 and I was having trouble with 10.6.6).

    After going through the update files I noticed Apple's method of removing the file was much more complex.

    Apple's Method for removing com.apple.batteryd.plist:
    Code:
    #!/bin/sh
    
    if [ -e "$3/System/Library/LaunchDaemons/com.apple.batteryd.plist" ]; then
    	sudo launchctl unload "$3/System/Library/LaunchDaemons/com.apple.batteryd.plist"
    	rm -rf "$3/System/Library/LaunchDaemons/com.apple.batteryd.plist"
    fi
    Could just deleting the plist like I did cause any harm?
     
  2. macrumors member

    #2
    Actually, what these lines are doing is: checking if the file exists, unloading it from the system (stoping the process) and, then, removing it. If you managed to remove it without issues, it was not running (or the system would complaint) and all is fine.
     
  3. macrumors 68000

    BeyondtheTech

    #3
    From what I can tell, Apple's script basically told launchd to stop trying to access the file, then delete the actual file.

    What you did was just delete the file, but not stop launchd from trying to run it.

    You should run the command as recommended.
     
  4. macrumors 6502a

    #4
    Thanks guys.

    I was mostly curious about 'launchctl unload' and the -r option for rm - The manual page says it 'Attempt's to remove the file hierarchy rooted in each file argument' - which confused me a bit. :p

    Unfortunately the update wasn't out at the time and I did the best with the information I had (basically a few posts on Apple's Forums). I'll do the unload command when I get on my Air later today, but my log's have been clear of any errors relating to batteryd.
     

Share This Page