本文借鑒與越獄開發(fā):用iosOpenDev配置越獄開發(fā)環(huán)境 編寫第一個hello world,記錄在安裝theos和iosOpenDev各種坑.如果有多個xcode請對應(yīng)安裝.
安裝工具包括:
1. 安裝Macports
MacPorts:安裝包管理工具(主要是安裝dpkg,將APP打包成Debian Package),直接點(diǎn)擊下載安裝,完成后在終端輸入命令
sudo port -v self update
如果報錯selfupdate does not accept string arguments請改為
sudo port selfupdate
更新完后輸入命令
sudo port -f install dpkg
如果報錯The Xcode Command Line Tools don't appear to be installed,需要安裝xcode命令行工具,操作如下
xcode-select --install
或打開xcod->偏好設(shè)置->更多開發(fā)工具,選擇對應(yīng)版本的command line tool下載安裝,然后重復(fù)錯誤前步驟.
macports安裝錯誤集
如果還是安裝不成功的話就安裝homebrew吧
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install dpkg
2. 安裝theos
如果你有多個xcode請執(zhí)行一下命令進(jìn)行選擇,我這里遇到一個坑,如Xcode 2.app,需要對空格轉(zhuǎn)義(\空格),配置makefile也是一樣.查看Xcode
system_profiler SPDeveloperToolsDataType
將Location:后面信息copy到下面命令中
sudo xcode-select -s /Applications/XcodeName.app/Contents/Developer
環(huán)境變量
export THEOS=/opt/theos
這里推薦使用以下theos版本,其他版本可能缺少部分文件導(dǎo)致異常錯誤
git clone -b stableversion https://github.com/haorenqq/theos/ $THEOS
配置ldid替換Xcode的codesign,下載附件
cd 創(chuàng)建空文件夾
git clone git://git.saurik.com/ldid.git
cd ldid
git submodule update --init
將附件中的openssl 文件夾放到 ldid 文件夾下,打開ldid中make.sh,將sudo xcode-select --switch /Applications/Xcode5-**.app,改為你選擇的xcode
./make.sh
cp -f ./ldid $THEOS/bin/ldid
sudo chmod 777 /opt/theos/bin/ldid
配置cydiaSubstrate,一個能夠hook任何進(jìn)程并修改代碼的插件,運(yùn)行theos自動化腳本,如果你不適用theos創(chuàng)建文件的話可以忽略此步驟.當(dāng)然感謝這位網(wǎng)友提供的theos包含bootstrap.sh,新的theos貌似沒有了
/opt/theos/bin/bootstrap.sh substrate
使用pp助手,ifunbox或scp等工具將/Library/Frameworks/CydiaSubstrate.framework/????????????????????????????????????????????????????????????????????????????????????????????????????????????????cydiasubtrate拷貝到/opt/theos/lib/libsubstrate.dylib(注意名字改了),當(dāng)然你也可以執(zhí)行下面步驟安裝完iOSOpenDev后將/opt/iOSOpenDev/lib/libsubstrate.dylib拷貝過來
此時theos已經(jīng)安裝成功了,你可以測試一下
/opt/theos/bin/nic.pl
關(guān)于theos的使用請自行腦補(bǔ)
3. 安裝iosOpenDev
將上文附件里Specifications文件夾咐旧,里面應(yīng)該有8個文件,iPhoneOS開頭的四個文件放到/應(yīng)用程序/Xcode/Content/Developer/Platforms/IphoneOS.platform/Developer/Library/Xcode/Specifications文件夾下(如果沒有亭饵,請自己創(chuàng)建一個),iPhone Simulator 開頭的另外四個文件放入/應(yīng)用程序/Xcode/Content/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications文件夾下(如果沒有梁厉,請同樣創(chuàng)建一個)辜羊。
另外在/應(yīng)用程序/Xcode/Content/Developer/Platforms/iPhoneSimulator.platform/Developer/文件夾下創(chuàng)建usr文件夾,usr文件夾下再創(chuàng)建一個名為bin的文件夾.
下載iosOpenDev,點(diǎn)擊安裝,commad + l查看安裝信息;
基本上打開對應(yīng)的Xcode就可以看到iosOpenDev的模板了.當(dāng)然對于iosOpenDev的使用可以參考上面提到的越獄開發(fā):用iosOpenDev配置越獄開發(fā)環(huán)境 編寫第一個hello world.