Install Applications Without WiFi

UPDATE: fixed some errors, added a bit more descriptions for the script, also added the missing file (anySIM) in the listing and script.

In most cases, iPhone application installation is simple, through Installer or iBrickr. However, in some extreme circumstances, eg. no WiFi and iBrickr daemon dies, you may have to manually install an application. This article describes how to do it

This article illustrates the method in details using anySIM as an example. Of course, you can install any application using the method demonstrated here.

Before you begin, make sure the iPhone has been jailbroken and activated, and your iPhone has been connected to your computer, if iTunes fires up, close it, remember to terminate iTunesHelper as well.

The method described here relies on iPHUC, so please fetch a copy of iPHUC from:

http://code.google.com/p/iphuc/ (for Mac OS X)
http://code.google.com/p/iphucwin32/ (for Windows)

This is the only tool you need in this article.

Get the File List

To install an application, first you need to know which files/folders have to be put onto the iPhone. Extract the anySIM.zip, after the extraction, there’ll be an anySIM.app folder. Enter the anySIM.app folder, and do a recursive directory listing, you’ll get the following files/folders list:

+-- anySIM
+-- background.png
+-- bgimage.png
+-- blankbg.png
+-- Default.png
+-- gray.png
+-- icon.png
+-- Info.plist
+-- libarmfp.dylib
+-- lock
|     |
|     +-- bgimage.png
|     +-- dial.png
|     +-- hook.png
|     +-- overlay.png
+-- PkgInfo
+-- secpack31206.bin
+-- secpack31408.bin
+-- secpack40113.bin
+-- slider.png
+-- strip.png
+-- UIPreferencesDeleteButtonNormal.png
+-- UIPreferencesDeleteButtonPressed.png
+-- well.png

NOTE: during the following operations, make sure you stay in anySIM.app folder.

Extract iPHUC

Extract the iPHUC package into anySIM.app folder, also copy the iTunesMobileDevice.dll (located at C:\Program Files\Common Files\Apple\Mobile Device Support\bin) into the same folder, iPHUC requires this dll to work.

Backup System Files

Before further operations, you need to backup some system files which will be replaced during the installation. You need to restore these files after the installation. Create a script file getfiles.script with the contents:

getfile /bin/chmod chmod
getfile /usr/sbin/update update
getfile /System/Library/LaunchDaemons/com.apple.update.plist com.apple.update.plist
exit

Save the script in anySIM.app folder. Now enter the following command to retrieve the files:

iPHUC < getfiles.script (Windows)
./iPHUC < getfiles.script (Mac OS X)

The three files (chmod, update and com.apple.update.plist) will be stored in your anySIM.app folder.

Upload Files to iPhone

Now you need to create a script for iPHUC to upload files (otherwise, you’ll have to manually create the folder and upload files one by one), the uploadfiles.script file with the contents:

mkdir /Applications/anySIM.app
putfile anySIM /Applications/anySIM.app/anySIM
putfile background.png /Applications/anySIM.app/background.png
putfile bgimage.png /Applications/anySIM.app/bgimage.png
putfile blankbg.png /Applications/anySIM.app/blankbg.png
putfile Default.png /Applications/anySIM.app/Default.png
putfile gray.png /Applications/anySIM.app/gray.png
putfile icon.png /Applications/anySIM.app/icon.png
putfile Info.plist /Applications/anySIM.app/Info.plist
putfile libarmfp.dylib /Applications/anySIM.app/libarmfp.dylib
putfile PkgInfo /Applications/anySIM.app/PkgInfo
putfile secpack31206.bin /Applications/anySIM.app/secpack31206.bin
putfile secpack31408.bin /Applications/anySIM.app/secpack31408.bin
putfile secpack40113.bin /Applications/anySIM.app/secpack40113.bin
putfile slider.png /Applications/anySIM.app/slider.png
putfile strip.png /Applications/anySIM.app/strip.png
putfile UIPreferencesDeleteButtonNormal.png /Applications/anySIM.app/UIPreferencesDeleteButtonNormal.png
putfile UIPreferencesDeleteButtonPressed.png /Applications/anySIM.app/UIPreferencesDeleteButtonPressed.png
putfile well.png /Applications/anySIM.app/well.png
mkdir /Applications/anySIM.app/lock
putfile lock/bgimage.png /Applications/anySIM.app/lock/bgimage.png
putfile lock/dial.png /Applications/anySIM.app/lock/dial.png
putfile lock/hook.png /Applications/anySIM.app/lock/hook.png
putfile lock/overlay.png /Applications/anySIM.app/lock/overlay.png
exit

Save the script in anySIM.app folder. The script is pretty straight forward, it creates an anySIM.app folder (and a sub-folder lock) under /Applications, then uploads files into the folder. Notice that every iPhone application folder name has a .app extension.

When everything’s ready, let’s start uploading. Enter the following command:

iPHUC < uploadfiles.script (Windows)
./iPHUC < uploadfiles.script (Mac OS X)

Fix the Executable Permission

All the iPHUC uploaded files have the permission 0644, we need to fix it for the executable files (which is anySIM in our example) which normally are 0555 (or 0755). Create a fakeupdate.plist file with the contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>com.apple.update</string>
   <key>ProgramArguments</key>
   <array>
      <string>/usr/sbin/update</string>
      <string>555</string>
      <string>/Applications/anySIM.app/anySIM</string>
   </array>
   <key>OnDemand</key>
   <false/>
</dict>
</plist>

Save the script in anySIM.app folder. NOTE: the <string>/Applications/anySIM.app/anySIM</string> line is the executable file which permission needs to be fixed, if there’re more than one executables, add them after the line, each executable file should occupy one line, like this:

<string>/path1/to/executable1</string>
<string>/path2/to/executable2</string>
<string>/path3/to/executable3</string>

Then create a permissions fix script fixperm.script with the contents:

putfile chmod /usr/sbin/update
putfile fakeupdate.plist /System/Library/LaunchDaemons/com.apple.update.plist
exit

Save it in anySIM.app folder. Now Enter the following command to do the fix:

iPHUC < fixperm.script (Windows)
./iPHUC < fixperm.script (Mac OS X)

When the above command finishes, reboot your iPhone. After the reboot, the permission should have been fixed. Next you need to restore the system files being replaced during the fix operations.

Restore System Files

Create a restore script restorefiles.script with the contents:

putfile update /usr/sbin/update
putfile com.apple.update.plist /System/Library/LaunchDaemons/com.apple.update.plist
exit

Save it in anySIM.app folder. Enter the following command:

iPHUC < restorefiles.script (Windows)
./iPHUC < restorefiles.script (Mac OS X)

When the command finishes, reboot iPhone.

You’re done :)


6 Comments

  1. Posted December 13, 2007 at 11:07 am | Permalink

    getfiles.script is a file?

    err no such command ‘getfiles.script’

  2. Posted December 13, 2007 at 2:03 pm | Permalink

    Yeah, you need to create it by yourself, notice the sentence: “Create a script file getfiles.script” in the post.

  3. Posted December 14, 2007 at 8:58 am | Permalink

    I create it,but run iPHUC < getfiles.script (Windows)

    they say no such command ‘getfiles.script’

  4. Posted December 14, 2007 at 3:46 pm | Permalink

    That means you didn’t create the file or the files is not in the current directory.
    UPDATE: I know what you did wrongly. You typed ‘iPHUC’ followed by an Enter key, then entered the ‘getfiles.script’ in iPHUC shell, which is definitely wrong! Didn’t you notice the command is ‘iPHUC < getfiles.script' ? It must be entered in one line.

  5. Posted December 14, 2007 at 4:55 pm | Permalink

    oh? I must type ‘iPHUC < getfiles.script’,not ‘getfiles.script’。

    right? thanks

  6. Powie
    Posted January 31, 2008 at 8:28 am | Permalink

    does it work with 04.03.13_G version ?

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*