Difference between revisions of "Theos on MAC OS"
(7 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
First, set the os path. <br> | First, set the os path. <br> | ||
<pre>export THEOS=/git/theos</pre> | <pre>export THEOS=/git/theos</pre> | ||
+ | In mac, you can do "vim ~/.bash_profile" and add "export THEOS=/git/theos" <br> | ||
Download from git, you can choose your own folder | Download from git, you can choose your own folder | ||
<pre> | <pre> | ||
Line 13: | Line 14: | ||
</pre> | </pre> | ||
'''There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib''' | '''There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib''' | ||
+ | |||
Install dkpg, download from<br> | Install dkpg, download from<br> | ||
http://www.macports.org/install.php<br> | http://www.macports.org/install.php<br> | ||
Line 21: | Line 23: | ||
</pre> | </pre> | ||
− | Additional templates<br> | + | Additional templates (optional)<br> |
https://github.com/DHowett/theos-nic-templates<br> | https://github.com/DHowett/theos-nic-templates<br> | ||
copy and paste to $THEOS/templates/iphone<br> | copy and paste to $THEOS/templates/iphone<br> | ||
Line 27: | Line 29: | ||
<pre> | <pre> | ||
$THEOS/bin/nic.pl | $THEOS/bin/nic.pl | ||
+ | </pre> | ||
+ | |||
+ | choose the tweak type.<br> | ||
+ | |||
+ | After edit you tweak<br> | ||
+ | add THEOS_DEVICE_IP = 10.101.66.113 <your device ip> into makefile<br> | ||
+ | also add ARCHS = armv7 arm64 into makefile <br> | ||
+ | |||
+ | <pre> | ||
+ | make package install | ||
+ | // enter your ssh password | ||
+ | </pre> | ||
+ | |||
+ | sample tweak.xm | ||
+ | <pre> | ||
+ | @interface NSString (MD5) | ||
+ | - (id)Md5String; | ||
+ | @end | ||
+ | |||
+ | %hook NSString | ||
+ | // log string before and after md5 | ||
+ | - (id)Md5String { | ||
+ | %log(@"HW: -------------------------Tweak: Md5String-------------------------\n"); | ||
+ | %log(self); | ||
+ | id ret = %orig; | ||
+ | %log(ret); | ||
+ | return ret; | ||
+ | } | ||
+ | %end | ||
</pre> | </pre> | ||
Line 32: | Line 63: | ||
<pre> | <pre> | ||
apt-get install socat | apt-get install socat | ||
− | + | socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock | |
+ | watch | ||
+ | </pre> | ||
+ | |||
+ | ==Logify== | ||
+ | <pre> | ||
+ | $THEOS/bin/logify.pl SomeClassHeader.h > tweak.xm | ||
+ | </pre> | ||
+ | see http://iphonedevwiki.net/index.php/Logify <br> | ||
+ | It can automatic generate tweak.xm file to log all functions provided in a header. | ||
+ | |||
+ | ==theos installation path== | ||
+ | <pre>/Library/MobileSubstrate/DynamicLibraries/</pre> | ||
+ | ==Application Path== | ||
+ | ios 8 | ||
+ | <pre> | ||
+ | /var/mobile/Containers/Bundle/Application/ | ||
+ | </pre> | ||
+ | ios9 | ||
+ | <pre> | ||
+ | /private/var/containers/Bundle/Application/ | ||
+ | </pre> | ||
+ | ==Application Document Path== | ||
+ | ios8 and ios9 | ||
+ | <pre> | ||
+ | /var/mobile/Containers/Data/Application | ||
</pre> | </pre> |
Latest revision as of 06:36, 26 July 2016
Contents
Install theos
This procedure works on Mac OS Yosemite.
First, set the os path.
export THEOS=/git/theos
In mac, you can do "vim ~/.bash_profile" and add "export THEOS=/git/theos"
Download from git, you can choose your own folder
cd /git git clone https://github.com/DHowett/theos.git
Generate substrate
sudo $THEOS/bin/bootstrap.sh substrate
There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib
Install dkpg, download from
http://www.macports.org/install.php
restart terminal after install
sudo port selfupdate sudo port install dpkg
Additional templates (optional)
https://github.com/DHowett/theos-nic-templates
copy and paste to $THEOS/templates/iphone
Now you can create tweaks from templates
$THEOS/bin/nic.pl
choose the tweak type.
After edit you tweak
add THEOS_DEVICE_IP = 10.101.66.113 <your device ip> into makefile
also add ARCHS = armv7 arm64 into makefile
make package install // enter your ssh password
sample tweak.xm
@interface NSString (MD5) - (id)Md5String; @end %hook NSString // log string before and after md5 - (id)Md5String { %log(@"HW: -------------------------Tweak: Md5String-------------------------\n"); %log(self); id ret = %orig; %log(ret); return ret; } %end
How to watch syslog in ios 8
apt-get install socat socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock watch
Logify
$THEOS/bin/logify.pl SomeClassHeader.h > tweak.xm
see http://iphonedevwiki.net/index.php/Logify
It can automatic generate tweak.xm file to log all functions provided in a header.
theos installation path
/Library/MobileSubstrate/DynamicLibraries/
Application Path
ios 8
/var/mobile/Containers/Bundle/Application/
ios9
/private/var/containers/Bundle/Application/
Application Document Path
ios8 and ios9
/var/mobile/Containers/Data/Application