1.安装brew,并安装ldid
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ldid
2.修改用户的环境配置
vim ~/.bash_profile //这个只是其中的一种方法
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
source ~/.bash_profile //环境变量立刻生效
3.下载theos
git clone --recursive https://github.com/theos/theos.git $THEOS
4.新建tweak项目
找一个目录存放代码
cd ~/Desktop
nic.pl
填写项目信息
Project Name
项目名称
Package Name ID
项目ID
Author/Maintainer Name
作者
默认是mac的用户名
[iphone/tweak] MobileSubstrate Bundle filter
需要修改APP的Bundle Idetifier
可以通过Cycript查看APP的Bundle Identifier
[iphone/tweak] List of applications to terminate upon installation
可以直接默认就好
5.编辑Makefile文件
在前面加入环境变量,写清楚通过那个IP和端口号访问手机
THEOS_DEVICE_IP
THEOS_DEVICE_PORT
export THEOS_DEVICE_IP=127.0.0.1 export THEOS_DEVICE_PORT=10010
include $(THEOS)/makefiles/common.mk TWEAK_NAME = ting_tweak
ting_tweak_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
如果不希望每个项目的MakeFile都编写IP和端口号环境变量,也可以添加到用户配置文件中
$ vim ~/.bash_profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010
$ source ~/.bash_profile
6.编写代码
%hook XMAdAnimationView
- (id)initWithImageUrl:(id)arg1 title:(id)arg2 iconType:(long long)arg3 jumpType:(long long)arg4
{
return nil; }
%end
%hook XMSoundPatchPosterView
- (id)initWithFrame:(struct CGRect)arg1 {
return nil; }
%end
7.编译-打包-安装
编译 make
打包成deb make package
安装 make install