Disable rootless on Mac OSX 10.11


  • misc
  • (Updated at )

OS X 10.11 及 iOS9 引進了 System Integrity Protection 也就是俗稱的 rootless 的保護機制,簡單的說他限制了所有非 Apple 軟體去更動系統自帶的檔案,這包含了系統上最高權限的帳號 root 也無法更動,所以即使有 root 權限的 sudo 命令,也會只得到 "Operation not permitted" 或 "can’t be modified or deleted because it’s required by OS X" 的結果。

立意是好的這毋庸置疑,對一般的使用者來說只有更安全,但對於進階者說來不便應該會多於安全。例如以字型來說,在安裝完或系統版本更新之後,關閉明體及楷書字體是我首先會調整的設定之一,因為這兩個字體實在不適合在電腦上閱讀使用,但大多數狀況下他的優先權卻又高於其他字體,能夠關閉的字體則在 Font.app 中完成,如果為系統字型無法關閉,我則會把字型由 /Library/Fonts 複製到 ~/Library/Fonts 然後就能在 Font.app 中關閉但並沒有真的刪除字型,這個動作在 rootless 的限制下就無法完成,更別說像 XtraFinder 這類的插件也都無法正常執行。

Disable rootless

唯一的方式只有關閉 rootless,要關閉 rootless 需要進入 Recovery mode,未進入回復模式下執行的 nvram 都沒有作用,系統重新啟動後就會再複原。

1. 開機始按住 command-r 進入 recovery mode
2. 於選單中選擇 Utility > Terminal 開啟終端機
3. 執行 csrutil disable 關閉 SIP
4. 重新啟動

完成上述動作,就完成關閉 rootless。可以再執行 csrutil status 確認 SIP 的啟用狀況,有需要重新開啟時,重複上述動作,指令改為 csrutil enable 則可重新開啟。

Terminal 過程如下

-bash-3.2# csrutil

Modify the System Integrity Protection configuration.  All configuration changes apply to the entire machine. 
Available commands:

    clear
        Clear the exiting configuration.  Only available in recovery OS. 
    disable
        Disable the protection on the machine.  Only available in recovery OS. 
    enable
        Enable the protection on the machine.  Only available in recovery OS.
    status
        Display the current configuration. 

    netboot 
        add ﹤address﹥
            Insert a new IPv4 address in the list of allowed netboot sources.
        list
            Print the list of allowed NetBoot sources. 
        remove ﹤address﹥
            Remove an IPv4 address from the list of allowed NetBoot sources. 

-bash-3.2# csrutil disable
Successfully disabled system integrity protection. please restart them machine for the changes to take effect.

有興趣更進一步瞭解 SIP 可以觀看 WWWDC2015 Security and Your Apps 影片
0 comment, 0 pingback