One of the things I really dislike when updating my iPhone to a newer iOS and jailbreaking it, is reinstalling all my jailbreak apps, one by one. This is a long and tedious job, especially if like me, you have a bunch of tweaks and jailbreak apps.

There is now an easy solution to backup all your jailbreak apps, tweaks, and themes, so you can update your iPhone, jailbreak, and reinstall those apps in no time. Here is how it works…

This method will save all your packages in a text file, that we’ll move to your computer. After updating and jailbreaking, we will import this text file into your iPhone.

Backing Up Your Packages

Step 1: Launch MobileTerminal on your iPhone.

Step 2: Type the following command: dpkg –get-selections> installed-apps.txt

Step 3: The previous command line will save a text file in /var/mobile called “installed-apps.txt”. Save this file on your computer via SSH.

Reinstalling Your Packages

After updating your iPhone to a newer iOS, you will have to jailbreak again and install MobileTerminal in Cydia. Then follow these instructions.

Step 1: SSH into your iPhone and copy the “installed-apps.txt” file in /var/mobile.

Step 2: Type the following commands in MobileTerminal

  • su
  • alpine (which is the default password. Type your password if you changed it)
  • dpkg –set-selections
  • apt-get dselect-upgrade

If you encounter any issue, type the following command: apt-get dselect-fix-missing-upgrade

Cydia will automatically reinstall all your packages.

[Kioskea]

  • Burntnacho

    Awesome tip! Thanks so much!

  • just curios, what is the difference between doing this vs using an app on Cydia like Packagebackup (I dont know the names but I know there’s apps that backup your Cydia apps/tweaks.) ?

    Anyways, it is always good to learn something new =)

    • Keith

      Use app called “aptbackup” in cydia it’s free and works great. Used it when I updated from 4.0 to 4.1. Install the app, click backup, sync with iTunes and it saves ur list. Upgrade, jailbreak, install aptbackup again.. Click restore. Done.

      • Irha

        Yep, I used AptBackup before and was pleasantly surprised when all apps were reinstalled with restore. The description of this app doesn’t do the justice to its functionality, as I used to believe, it only creates a named list of jailbroken apps and you are somehow responsible to reinstall them.

  • Jlowry

    Pkgbackup will do this too. This is just a free alternative.

  • Brandon

    Also the command is dpkg –get-selections > installed-apps.txt

    • appletiser

      thanks 🙂

  • Burge

    PkgBackup is alot easer.. Cost $4.99 or free if you know where

  • DGizza

    how can i get all of my cydia apps back without downloading 1 by 1

    • brent

      wow

    • Z

      The joke of the day! lol

    • Burge

      @DGizza
      You should not have a jailbroke iPhone…lol…

      • pachi

        Why not? Iphone is garbage without JB.

  • dpkg-get-selections: command not found

    could you please type the correct notation? TY!

    • Brandon

      dpkg –get-selections — Note the space and two dashes after dpkg.

  • ok – i’ve found it by myself

    http://debiananwenderhandbuch.de/dpkg.html#dpkggetgs

    now go on and find your syntax error 😉

  • DoNt WoRrY aBoUt It

    say it can’t be found ???????i typed it and re-typed it like 3wice and still nothing?????? help meeee i want to get everything i have on ios 4.1 to ios 4.2.1 and i have an ipod touch so pplz don’t tell me don’t do it …. and i know how to cheat out the connect to pc everytime i need to reboot so im kk

    • Alex23

      The real command is actually dpkg –get-selections> installed-apps.txt notice the extra dash before “get”

  • Damian

    Mobile Terminal doesn’t work on iPhone 3GS IOS 4.x
    Do anybody know how to fix it or any alternative to run the same command without Mobile Terminal ?
    Thanks…

    • Z

      Add insanelyi or iosrepo and you’ll find mobileterminal for ios4 there

      • Burge

        Nice to see this repos are coming in handy…lol…

    • Juan

      install openssh and do it remotely.

  • Mobole Terminal works great on my 3GS, ios 4.1, new bootrom. Just search Saurik’s tweets. A time ago he posted a link to a deb pkg with a working version 😉

  • Apple everything

    Search for mobileterminal ios4 it works you will find it in cydia

  • Mark

    If i have a couple of tweaks that had installation errors and i want to restore all other cydia tweaks, leaving out the one thats gives an error message, can i do that? Pls email me, need help urgently, thanks!

    • Z

      You would probably have to edit the text. I haven’t looked what the list looks like, but it might actually be very easy as to just delete the name of the tweak.

      At last, you can always remove everything unwanted prior proceeding with instructions. This is the safest way to do it, I think.

  • DomPerignon

    With PKGBackup it’s easier and cleaner.

    • Juan

      yep. perfect for those less experienced with linuxy commands and such. personally it’s what I’ve been using for well over a year. coupled with SBOrganizer, it saves your SB layout if you’re using folder tweaks like infinifolders or folder enhancer. (iTunes can’t restore icons placement with the mentioned folder tweaks).

  • Z

    Great tip, Sebastien! Useful to know, though pwnagetool allows you to pick packages =)

  • XDark

    Question… if i change iphones …. can i do the same? meaning do the save pkgs in the old and download it in the new one??

  • Thomas G.

    Lol mine makes a txt file with 0 bytes…
    Nothing in it.

    • appletiser

      lol so was mine until i saw someone else post the correct cmd line above:

      dpkg –get-selections > installed.apps.txt

      my file now read 5.8kb 🙂

  • Can I used apps purchased for my iPhone 3 on my iPhone 4 without having to purchase them again?

    • Juan

      if you paid via Cydia, yes. You can usually install those purchase via Cydia on unlimited devices. there are, however, some devs that have their own payment gateway and thus handle licenses outside of Cydia. Most of these apps have limit on the number of devices. Often you can transfer licenses to new devices.

  • appletiser

    anyone else having issues where some packages are being missed from the backup list, for example MiTube and VLC aren’t being picked up by the MobT or PKGBackup methods.

  • zoogirly

    regarding using PkgBackup as a easy restore option, if you check “List of Jailbreak Apps Compatible with iOS 4.2.1” (http://www.iphonedownloadblog.com/2010/11/25/list-of-jailbreak-apps-compatible-with-ios-4-2-1/) on this blog, you’ll find that right now PkgBackup DOES NOT work under iOS 4.2.1 right now. Just a heads-up here for anyone relying on it.
    I’m sure this will change soon.

  • David

    What is the most important is not only to have your apps reinstalled, but more to have their settings transferred and reinstalled too. Same for savegames, etc ….

  • Alemayehu

    I like very much my I phone 4 but I need timely updates with new softwhere.anyhow iPhone 4is everything
    So please send mr updated softwhere

  • Great article! Very helpful!!

  • David

    What about app/tweak settings? is there a way to back those up?

  • kendoisonfire

    Can’t get mobile terminal to find the app list.

    This command doesn’t do anything: apt-get dselect-upgrade

  • Use APTbackup. Download, use….upgrade, jailbreak, redownload, and use again. Everything from cydia you had will be reinstalled. Works fine, ive used it, and its free.

    • Keith

      Yeah, aptbackup works great. Used it when I upgraded from 4.0 to 4.1. So tired of manually installed all my apps and theme.. It also saves almost all of your settings too. So u don’t have to use winterboard to resetup ur looks.

  • Jekel35

    Is anyone else having issues with the last line of the those commands. The “apt-get dselect-upgrade” aspect. I keep getting an “unwanted status” error. Any help???

  • iPhoner

    This post is a mess, probably its author didn’t try for himself! That’s what you get for copy/paste random forum ideas…
    You may use any SSH terminal program such as Putty or WinScp but you’ll need to install OpenSSH from Cydia sources.
    If you use MobileTerminal be sure to install all APT packages from Cydia sources, otherwise apt-get command won’t work!
    So for backing up the first command should be typed dpkg –get-selections > installed-apps.txt as [dpkg][space][-][-][get][-][selections][space][>][space][installed-apps.txt]
    For restoring the commands should be:
    su
    alpine
    dpkg – -set-selections < installed-apps.txt
    apt-get dselect-upgrade

    Or use this one
    apt-get – -fix-missing dselect-upgrade

    Usually the installed-apps.txt will install a lot of stuff that may be buggy on your new iOS, if run into trouble you may edit that txt file and replace the 'install' command bellow each suspicious package with 'deinstall'.

    • Irha

      “probably its author didn’t try for himself! That’s what you get for copy/paste random forum ideas”

      Funny, aren’t most bloggers like this anyway? While trying to copy as fast as possible from one blog to another, they don’t even try to understand the steps or validate them.

    • mike

      how do you know if you have all the apt packages

  • April

    iPhoner, thank you SO MUCH for providing the correct syntax for restoring a list of backed up Cydia apps! Nothing is more frustrating than reading post after post where people have just copied the same WRONG or INCOMPLETE information. What a relief to find the right answers!

    The commands you posted worked perfectly. Again, thanks!

  • Orine

    This is so messed up! For those who are having app-get issues, you need to know that apt commands are not available by default in the iphone terminal!

    You might read some forums asking you to download Aptitude from Cydia to get that command working, but trust me you wouldn’t find it anymore.

    Instead download Aptbackup. It will install the required components, then you can continue in the terminal! I’ve dug hours for 1 guy who finally made things clear for me!

    • Orine

      sorry i meant “apt-get”, NOT “app-get”!!!

  • mike

    what do i type when it says mikes-ipod: /var/mobile root#
    i have tried alll the commments and nothing will work

  • mike

    I have jailbroken phone with several cydia apps. but computer where my itunes apps are located has bad hard drive so all is gone. i authorized new pac and all apps are there so i want to start using new pc to sync, but it says it will erase all apps on device before syncing. does that mean it will erase the cydia apps too or just the itunes apps? please clarify

    • Irha

      Itunes sites not manage cydia apps so you should be fine.

  • Haider Ijaz

    This method works now or not anymore?

    • Irha

      I just upgraded from 4.0.2 to 4.2.1 last night and AptBackup worked perfectly fine for me. I took a backup right before upgrade and copied the 3 files it creates under Library/Preferences. After the upgrade and jailbreak, I installed AptBackup and took a backup to get its state right, then installed ssh and copied over the 3 files to the same location. I started up AptBackup again and then hit restore. Everything seems to be back in place, including sbsettings and sources.

  • Patrickc

    Tried this, didnt work – Because he has a bit of missing code!

    Here is the code to restore:

    Reinstalling Your Packages
    Log In:
    su (then enter)
    (Your Password)
    Enter this in Mobile Terminal:
    dpkg(Space)–set-selections(Space)<(Space)installed-apps.txt
    apt-get(Space)dselect-upgrade

    Or use this one if you are getting errors:
    apt-get(Space)–fix-missing(Space)dselect-upgrade

  • yongeasy

    Download Aptbackup from cydia, that is the only way the mobile terminal know how to read the (apt-get dselect-upgrade)

    Just did that now it’s installed all my apps

  • Patrickc

    my aptbackup kept crashing when i started it

    • yongeasy

      You don’t have to run the apps, all you need is the aptbackup to been on the phone that is all. go back to mobile terminal follow those commands.
      Hope that help

  • Bruno

    thanks Patric.

  • Bruno

    IT FUCKED MY IPHONE AFTER ALL!