Skip to content
kabiroberai edited this page Dec 2, 2016 · 14 revisions

General Usage

Make sure that you have installed Theos Jailed before following this guide.

  1. Extract and decrypt your target app. Save as a .ipa
  • Change to the base directory for your tweak (eg. cd ~/Desktop)
  • Run nic.pl and choose the jailed template
  • Enter a name for your tweak
  • Enter an absolute or relative path to your decrypted .ipa file
  • Change into your new tweak directory (eg. cd ~/Desktop/mytweak)
  • Edit Tweak.xm as necessary
  • Optionally create a Resources folder, which will be merged with the app bundle. If this directory contains an Info.plist, the keys will be merged too
  • Run make info and follow the instructions to create a Provisioning Profile
  • Run make package install [PROFILE=<your.bundle.id | file.mobileprovision>]. Omit PROFILE=... to use Xcode's Wildcard App ID
    • Set TWEAK_NAME_USE_CYCRIPT=1 to be able to remotely attach to Cycript using cycript -r hostname:31337
    • Set TWEAK_NAME_USE_FISHHOOK=1 to use fishhook (remember to #import <fishhook.h> as well)

Injecting a Cydia tweak

You can easily inject a tweak available on Cydia into an app of your choice, in only a few steps.

  1. Download the tweak as a .deb file. To find a website that lets you do this, Google Cydia Updates
  • Unpack the .deb file, using the command dpkg-deb -R file.deb destination
  • Extract and decrypt the app targeted by the Cydia tweak. Save as a .ipa
  • Create a new Theos project with the jailed template, using the decrypted .ipa
  • Copy the unpacked tweak at destination/Library/MobileSubstrate/DynamicLibraries/tweak-name.dylib to the root folder of your project, replacing tweak-name with the name of the tweak you downloaded
  • Add DYLIB = tweak-name.dylib to the top of Makefile
  • Follow step 8 and 9 of General Usage

Adding dependencies

Many tweaks require external dependencies. To use one, you must first fix the install name of the dependency and the libraries it links against.

  1. Download and extract the dependency .deb, similarly to the tweak
  • Follow steps 2 and 3 of Dynamic frameworks
  • Run install_name_tool -id @executable_path/Frameworks/dependency.dylib Resources/Frameworks/dependency.dylib
  • Run otool -L tweak-name.dylib to see the current linked path to the dependency
  • Run install_name_tool -change /current/path/to/dependency.dylib @executable_path/Frameworks/dependency.dylib

Note: Some dependencies (such as uasharedtools) do not work with jailed devices, and thus tweaks that require them will not work.

Using frameworks

External frameworks may be of two types: static and dynamic. To find out which your framework is, run the following command:

file Foo.framework/Foo | grep -q "Mach-O dynamically linked shared library" && echo "Dynamic" || echo "Static"

If you have a .dylib file, follow the instructions in Dynamic frameworks

Static frameworks

  1. Copy the .framework into your project's root directory
  • Open Makefile in your favourite text editor
  • Add TWEAK_NAME_LDFLAGS = -F. and TWEAK_NAME_CFLAGS = -F. above include $(THEOS_MAKE_PATH)/tweak.mk, replacing TWEAK_NAME with the name of your tweak
  • Below the lines you just added, add another line: TWEAK_NAME_FRAMEWORKS = Foo. Of course, replace Foo with the name of your framework
  • If you need to add any libraries, append them to the LDFLAGS line. For example, if I wanted to add libxyz.tbd to my project, I would change my LDFLAGS line to TWEAK_NAME_LDFLAGS = -F. -lxyz
  • Import your framework in Tweak.xm using #import <Foo/Foo.h>

Dynamic frameworks

  1. Dynamic frameworks are only supported in iOS 8 and above. Add TARGET = iphone:gcc:latest:8.0 to the beginning of your makefile
  • Create a Resources folder in your project's root directory. The contents of this directory will be merged with your target app's root directory
  • Make a Frameworks folder in Resources, and copy your framework into that directory
  • Follow steps 2 to 6 of Static frameworks, but replace -F. with -FResources/Frameworks in step 3

Note: Dynamic frameworks don't seem to be working correctly right now. I'll update this page with more details once the issue is fixed.

Making an Extensify Exo

Theos Jailed makes it extremely easy to package a project as an Extensify Exo.

  1. Run make package PACKAGE_FORMAT=exo
  • The exo will now be packaged as a .zip file in your project's packages directory. You can run make show to view it
Clone this wiki locally