Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

#Loading Tweaks in the Simulator

With the latest updates to the simulator, this turns out to be pretty simple:

You need to be using kirb/theos

In order not to require MobileSubstrate to be loaded and your tweak to be compiled for i386/x86_64, add

In your makefile:

TARGET = simulator:clang:latest:7.0
tweakname_USE_SUBSTRATE = 0

Then run the simulator and enter in terminal:

xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=.theos/obj/debug/Blah.dylib
xcrun simctl spawn booted launchctl stop com.apple.SpringBoard

(from conradev)

This should work for any process, though I havent tried.

DYLD_INSERT_LIBRARIES is a colon seperated list, so multiple dylibs can be loaded.

If deploying to the iOS 9 simulator you'll need to replace

#if TARGET_IPHONE || TARGET_IPHONE_SIMULATOR

with

#if TARGET_IPHONE || TARGET_OS_SIMULATOR

in $THEOS/prefix.pch as TARGET_IPHONE_SIMULATOR is deprecated in iOS 9 (fixed in the latest version of kirb/theos)

If you're having any further problems it's probably due to a dodgy theos setup - I'd recommend installing fresh from kirb/theos

@neoighodaro

This comment has been minimized.

Copy link

commented Sep 24, 2015

I followed this to the letter even installing a fresh installation of kirb/theos (which doesn't even generate a .theos/obj/debug/sometweak.dylib file btw) and I get loads of errors. Do I need a specific version of xCode?

@greenywd

This comment has been minimized.

Copy link

commented Oct 6, 2015

@CreativityKills did you setup kirb/theos properly following the instructions of installing dhowett/theos first then changing the origin to point towards kirb/theos?

@neoighodaro

This comment has been minimized.

Copy link

commented Oct 24, 2015

Yes. I get this.

➜ testtweak xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=.theos/obj/debug/testtweak.dylib
Unrecognized subcommand: debug
Usage: launchctl ... | help [subcommand]
Many subcommands take a target specifier that refers to a domain or service
within that domain. The available specifier forms are:

@neoighodaro

This comment has been minimized.

Copy link

commented Nov 2, 2015

hellooooooo

@CFarzaneh

This comment has been minimized.

Copy link

commented Nov 4, 2015

Hey everything works perfectly with iOS 9 simulator but when I run the same command on 8.4 simulator I get:
Unrecognized subcommand: debug

I tried removing that argument and I still get errors

@greenywd

This comment has been minimized.

Copy link

commented Nov 19, 2015

@CreativityKills @CFarzaneh You need to use the iOS 9 sim, anything else won't work (at this point in time)

@jirachi155

This comment has been minimized.

Copy link

commented Mar 6, 2017

Any way to load PreferenceBundles too? Need to test a tweak with settings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.