Disable OS X System Integrity Protection



Disable OS X System Integrity Protection

不过今天要 fix 的是这个叫做 System Integrity Protection (SIP) 的东西,又叫 rootless,总之就是保护系统了。听上去感觉很有用的样子,似乎确实也很有用,不过刚出来的时候好像导致 homebrew 出了很多问题,然后最近由于 DYLD_LIBRARY_PATH 的问题终于忍无可忍决定要把它 disable 掉。

对 Linux 编程熟悉的同学应该都知道 LD_LIBRARY_PATH,就是可以设置一些搜寻动态链接库的路径,通常安装一些第三方的库,如果不是直接安装到系统的 /usr/lib 之类的路径下面去(比如没有 root 权限,或者不想污染系统)的话,就可以把任意的路径加到 LD_LIBRARY_PATH 里去,让其他的程序还是可以找得到这个第三方库的 shared library。而 DYLD_LIBRARY_PATH 就是 OS X 的 LD_LIBRARY_PATH 对应物(好像直接用 LD_LIBRARY_PATH 也可以)。

然后现在 SIP 为了"安全起见",把 LD_LIBRARY_PATH 和所有 DYLD_ 开头的环境变量全部禁用了。症状就是一个程序在启动一个子进程的时候,是会继承父进程的环境变量的,但是环境变量里的这几个项会被系统给屏蔽掉。我也不知道为什么这个会破坏系统安全,但是确实这样之后带来各种各样的麻烦,比如在 iPython 里要是用到 CUDA 的库之类的,就会找不到 shared library。如果想用 lldb 去调试一个依赖于一些第三方动态库的程序,或者用 Makefile 来启动一些 tests,也会发现找不到这些动态链接库。之前找到一个临时的解决办法是先用 otool -L 来列出你编译出来的程序依赖于哪些未 resolve 的动态链接库,比如这样的:

your-program-file 

Read full article from Disable OS X System Integrity Protection


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts