一蚪燕、安裝簽名工具ldid
先確保安裝了brew
$ /usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
利用brew安裝ldid
$ brew install ldid
二、修改環(huán)境變量
編輯用戶的配置文件
$ vim ~/.bash_profile
在.bash_profie文件后面加入以下2行
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
讓.bash_profiel配置的環(huán)境變量立即生效(或者重新打開終端)
$ source ~/.bash_profile
三、下載theos
建議$THEOS目錄下載代碼(也就是剛才配置的~/theos目錄)
$ git clone --recursive https://github.com/theos/theos.git $THEOS
theos的bin目錄中有nic.pl 成艘、logify.pl,可通過以下命令查看
~/theos/bin zy$ ls -l
theos的bin目錄
四爪飘、新建tweak項目
cd到一個存放項目代碼的文件夾(比如桌面)
$ cd ~/Desktop
$ nic.pl
選擇[11.] iphone/tweak
截屏2022-10-06 下午3.11.07.png
填寫項目信息
Project Name (required): ting_tweak
Package Name [com.yourcompany.ting_tweak]: com.mj.ting
Author/Maintainer Name [MJ Lee]:
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]:
com.gemd.iting
[iphone/tweak] List of applications to terminate upon installation (space-
separated, '-' for none) [SpringBoard]:
Instantiating iphone/tweak in ting_tweak/...
Done
五、編輯Makefile
在前面加入環(huán)境變量砌左,寫清楚通過哪個IP和端口訪問手機(jī)
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和端口環(huán)境變量脖咐,也可以添加到用戶配置文件中
$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
六铺敌、編寫代碼
打開Tweak.xm文件
%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
七、編譯-打包-安裝
編譯
make
打包成deb
make package
安裝(默認(rèn)會自動重啟SpringBoard)
make install