iOS 3.1 Speed Up Your iPhone/iPod by Removing Launch Daemons

Discussion in 'iOS Jailbreak & Cydia' started by Sarcasm Siempre, Jul 30, 2009.

Thread Status:
Not open for further replies.
  1. djustiz New Member

    Member Since:
    Aug 5, 2011
    Message Count:
    1
    Hi all

    First post here. I have been trying to free up memory and cpu cycles on my old 3G for months now, following different guides I found on the internet, and I have concluded, that most tweaks hardly do anything without taking away some functionality that I actually want - like spotlight search. Then it dawned on me, that launchd doesn't just start processes and keep them running. It also provides the possibility of starting and stopping processes on demand. By tweaking KeepAlive and ExitTimeOut settings in different launchdaemon plists I have got a device that for the most part is faster, have more ram available, and doesn't loose any functionality whatsoever. The daemons that responds best to this kind of tweaking seems to be:
    searchd (spotlight)
    installd
    accessoryd
    dataaccessd
    locationd
    mediaremoted

    These daemons now start when needed and quits again after being idle for a few seconds. when I'm not seaching with spotlight, using location services, syncing or installing my 3G is only running 17 processes (including phone and mail), and has approximately 50 Mb free memory. Oh - and it drastically improved my batterylife - probably mostly due to locationd not running when not in use.

    The Mod works like this; launchd does NOT work like a DOS/windows batch file that simply loads everything and keeps it in memory - it has very sophisticated process control functions - like a combination of init.d and watchdog on*NIX. In short - it is able to monitor when certain daemons are needed, and when they are not. Thus searchd can be configured to start up once you enter the spotlight page, and exit again after being idle for a set time.

    For the listed daemons I set the KeepAlive option to 'false' (boolean), and I've set ExitTimeOut to 3 (integer). I recommend reading the man-page for launcd. :)

    Here's an example of an edited com.apple.accessoryd.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>ExitTimeOut</key>
    <integer>3</integer>

    <key>JetsamProperties</key>
    <dict>
    <key>JetsamPriority</key>
    <integer>-49</integer>
    </dict>
    <key>KeepAlive</key>
    <false/>

    <key>Label</key>
    <string>com.apple.accessoryd</string>
    <key>MachServices</key>
    <dict>
    <key>com.apple.accessoryd</key>
    <dict>
    <key>ResetAtClose</key>
    <true/>
    </dict>
    </dict>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/sbin/accessoryd</string>
    </array>
    <key>RunAtLoad</key>
    <false/>

    <key>UserName</key>
    <string>mobile</string>
    </dict>
    </plist>

    The ExitTimeOut value defines the idle time in seconds before launchd terminates the process. (the default is 30 seconds)
    KeepAlive defines whether the process needs to be running continuously, or if launchd is allowed to shut it down when its idle. KeepAlive has a lot of different parameters to define under what circumstances the process should be running, but if you want it to shut down as much as possible, the key needs to be a simple boolean false.
    The RunAtLoad key specifies if the daemon is to start running immediately (during boot), or if launchd should wait and launch it on demand. The default launchd value is false, I only set it in accesoryd because it was set to true by apple.

    Most of the daemons on the iphone is already configured by apple to be launched when needed, and killed off when idle - and removing them will not free up additional ram on your device - perhaps during the first few minutes after startup since many of them has the RunAtLoad flag set to true - but after launchd has killed them off after the default ExitTimeOut period they will not take up any precious ram unless you use those specific features. Deleting them may however speed up the booting process. The daemons I chose to manipulate was the ones that was continuously running on my system - even after several minutes of idling. Only I do not know if this is also true for the "safe" daemons (crashreporting etc.) - since I deleted those from my system, and have not yet tried to reenable them to see what is actually running.

    Here's a zip of the aforementioned plists. I'd recommend backing up your original files before you start to edit/swap any plist-files.
    Edited launchdaemons
  2. pineapple juice Well-Known Member

    Member Since:
    Mar 2, 2011
    Message Count:
    3,391
    Device:
    Nexus 7
    For those of you who are on iOS 5, LaunchDeamons are now located in /Library/LaunchDaemons.
  3. xXrkidXx Well-Known Member

    Member Since:
    Mar 27, 2009
    Message Count:
    4,615
    Device:
    iPhone 5 (Black)
    No, there still in /System/Library/LaunchDaemons.

    That is just the OpenSSH daemon...

    EDIT

    And btw, this is useless for iOS 5, atleast until an untethered jailbreak is out. When booted tethered via redsn0w(not sure about iBooty as it doesn't load files from an IPSW, does it?) redsn0w will load all of the processes anyways.
  4. Ackbar Active Member

    Member Since:
    Jun 18, 2011
    Message Count:
    765
    Device:
    2G iPod touch
    I just discovered that com.apple.BTServer.plist controls bluetooth connectivity. I was able to delete it with no problems.
  5. squirrelman1000 Member

    Member Since:
    Feb 20, 2010
    Message Count:
    327
    Device:
    iPhone 4 (Black)
    wait even if i delete the daemon redsn0w will still run the .plist files?? that doesnt make sense so how do we speed up the phone
  6. xXrkidXx Well-Known Member

    Member Since:
    Mar 27, 2009
    Message Count:
    4,615
    Device:
    iPhone 5 (Black)
    Somebody TOTALLY read the original post :rolleyes:
    Well.. You don't. I have an idea, but I haven't tested it and I don't have the time to restore if it doesn't go well... If somebody's willing to help then we can try it.
  7. squirrelman1000 Member

    Member Since:
    Feb 20, 2010
    Message Count:
    327
    Device:
    iPhone 4 (Black)
  8. xXrkidXx Well-Known Member

    Member Since:
    Mar 27, 2009
    Message Count:
    4,615
    Device:
    iPhone 5 (Black)
    Open the plist you wish to remove and find where it tells you where the executable is.(Most cases it's in usr/libexec) remove the executable and then theres nothing for redsn0w to run. I haven't tested, but it WILL not run the process. No promises on what happens to your device however.
  9. donzzy New Member

    Member Since:
    Nov 4, 2011
    Message Count:
    1
    restore deleted daemon

    Hi,

    To my dismay, I wasn't able to backup a certain launch daemon named com.apple.searchd.plist.

    I need this badly since I can no longer search for my iPod touch files.

    Anyone? :)
  10. Ackbar Active Member

    Member Since:
    Jun 18, 2011
    Message Count:
    765
    Device:
    2G iPod touch
    Hmmm. Really?

    From Original Post:
    •com.apple.BTServer.plist - If this daemon is disabled, your device will become extremely slow and unresponsive.

    Mine said that BTServer controls bluetooth connectivity and I had no problems deleting it. No lag, just no bluetooth.

    Did YOU read the original post? :rolleyes:
Thread Status:
Not open for further replies.