removal Question

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

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

    Quad5Ny macrumors 6502a


    Sep 13, 2009
    New York, USA
    I have a new MacBook Air and it came shipped with a bogus plist ( 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:
    1/13/11 11:09:31 PM[1] ([1114]) Exited with exit code: 1
    1/13/11 11:09:31 PM[1] ( Throttling respawn: Will start in 10 seconds
    1/13/11 11:09:41 PM[1] ([1115]) posix_spawn("/usr/local/libexec/batteryd", ...): No such file or directory
    So I went into Terminal and typed ' sudo rm "/System/Library/LaunchDaemons/" ' and everything is as it should be, but I just noticed Apple released a update that's meant to fix this. - (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
    if [ -e "$3/System/Library/LaunchDaemons/" ]; then
    	sudo launchctl unload "$3/System/Library/LaunchDaemons/"
    	rm -rf "$3/System/Library/LaunchDaemons/"
    Could just deleting the plist like I did cause any harm?
  2. lucashungaro macrumors member

    Nov 20, 2010
    São Paulo, Brazil
    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. BeyondtheTech macrumors 68020


    Jun 20, 2007
    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. Quad5Ny thread starter macrumors 6502a


    Sep 13, 2009
    New York, USA
    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