class-dump最新安裝方法

當(dāng)Mac升級了OSX 10.11后,配置class-dump的時候,會發(fā)現(xiàn)逆向書上推薦的class-dump存放目錄/usr/bin,class-dump存放不進去,嘗試過用sudo 還是不被允許。

  • 原因是 OSX10.11的一個新特性 Rootless,也叫System Integrity Protection(SIP)和SELinux差不多,都是限制root用戶的權(quán)限。
    其實可以在RecoveryMode關(guān)閉這個特性,這樣就直接可以讀寫/usr/bin了,不過不建議。
    (關(guān)閉方法:開機的時候按住option出現(xiàn)選擇磁盤的界面按command + R進入RecoveryMode,選擇實用工具終端,輸入csrutil disable回車搞定)

查找網(wǎng)上的資料,目前我用的方法是改變 class-dump 的環(huán)境變量來使用。
class-dump下載地址:http://stevenygard.com/projects/class-dump/

  1. 首先打開Terminal,輸入mkdir ~/bin,在當(dāng)前用戶根目錄下創(chuàng)建一個bin目錄。
  2. 把下載下來的 dmg 打開,復(fù)制文件里面的class-dump到創(chuàng)建的bin目錄下。賦予其可執(zhí)行權(quán)限:
chmod +x ~/bin/class-dump
  1. 打開bash_profile文件配置環(huán)境變量:
vim ~/.bash_profile

**按下 i 鍵進入編輯狀態(tài),在最下方加一行 **

export PATH=$HOME/bin/:$PATH

按下esc鍵,再按 shift + ":" 輸入 "wq" 進行保存退出編輯

  1. 在Terminal中執(zhí)行
source ~/.bash_profile

完成!

  1. 測試是否改變成功

測試結(jié)果為:

MelodydeMBP:~ melody$ class-dump 
class-dump 3.5 (64 bit)
Usage: class-dump [options] <mach-o-file>

  where options are:
        -a             show instance variable offsets
        -A             show implementation addresses
        --arch <arch>  choose a specific architecture from a universal binary (ppc, ppc64, i386, x86_64, armv6, armv7, armv7s, arm64)
        -C <regex>     only display classes matching regular expression
        -f <str>       find string in method name
        -H             generate header files in current directory, or directory specified with -o
        -I             sort classes, categories, and protocols by inheritance (overrides -s)
        -o <dir>       output directory used for -H
        -r             recursively expand frameworks and fixed VM shared libraries
        -s             sort classes and categories by name
        -S             sort methods by name
        -t             suppress header in output, for testing
        --list-arches  list the arches in the file, then exit
        --sdk-ios      specify iOS SDK version (will look in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
        --sdk-mac      specify Mac OS X version (will look in /Developer/SDKs/MacOSX<version>.sdk
        --sdk-root     specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)
MelodydeMBP:~ melody$

到了這里 class-dump的安裝基本完成了^ ^

感謝你們的閱讀,歡迎來糾錯與交流。

參考鏈接:
http://bbs.iosre.com/t/10-11-usr-bin-class-dump/1936/8
http://blog.csdn.net/majiakun1/article/details/52064435

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容