[oh-my-zsh] 提示檢測到不安全的完成相關(guān)目錄

問題

運(yùn)行命令時(shí)镐躲,[oh-my-zsh] 冒出下面一大堆提示:

[oh-my-zsh] Insecure completion-dependent directories detected:
drwxr-xr-x   16 duke  staff   512 Jul 14 10:14 /Users/duke/.oh-my-zsh
drwxr-xr-x  250 duke  staff  8000 Jul 14 10:14 /Users/duke/.oh-my-zsh/plugins
drwxr-xr-x    4 duke  staff   128 Jul 14 10:14 /Users/duke/.oh-my-zsh/plugins/git
drwxr-xr-x    3 duke  staff    96 Jun 17 11:33 /usr/local/share/zsh
drwxr-xr-x    6 duke  staff   192 Oct  3 10:04 /usr/local/share/zsh/site-functions
lrwxr-xr-x    1 duke  staff    39 Jun 17 11:37 /usr/local/share/zsh/site-functions/_brew -> ../../../Homebrew/completions/zsh/_brew
lrwxr-xr-x    1 duke  staff    44 Jun 17 11:37 /usr/local/share/zsh/site-functions/_brew_cask -> ../../../Homebrew/completions/zsh/_brew_cask
lrwxr-xr-x    1 duke  staff    58 Oct  3 10:04 /usr/local/share/zsh/site-functions/_git -> ../../../Cellar/git/2.19.0_2/share/zsh/site-functions/_git

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

解決

問題的描述中给涕,其實(shí)已經(jīng)給了我們解決方法:

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

要修復(fù)權(quán)限穗椅,可以通過禁用“group”和“others”的寫入權(quán)限并確保這些目錄的所有者是root用戶或當(dāng)前用戶來修復(fù)權(quán)限吁恍。
以下命令可能有所幫助:
compaudit | xargs chmod g-w胰舆,o-w
如果上面沒有幫助册舞,或者你想跳過不安全目錄的驗(yàn)證蕴掏,你可以在你的zshrc文件中找到oh-my-zsh之前將變量ZSH_DISABLE_COMPFIX設(shè)置為“true”。

第一種解決方法:修改相關(guān)文件夾權(quán)限

為以上提示的文件夾修改權(quán)限(根據(jù)具體提示修改)

chmod 755 /Users/duke/.oh-my-zsh
chmod 755 /Users/duke/.oh-my-zsh/plugins
chmod 755 /Users/duke/.oh-my-zsh/plugins/git
chmod 755 /usr/local/share/zsh/site-functions
chmod 755 /usr/local/share/zsh/site-functions/_brew
chmod 755 /usr/local/share/zsh/site-functions/_brew_cask
chmod 755 /usr/local/share/zsh/site-functions/_git

第二種解決方法:設(shè)置變量 ZSH_DISABLE_COMPFIX=true

  1. 在.zshrc文件的第一行添加 ZSH_DISABLE_COMPFIX=true
  2. 運(yùn)行source命令调鲸,重新加載.zshrc文件
source ~/.zshrc
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末囚似,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子线得,更是在濱河造成了極大的恐慌饶唤,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,198評(píng)論 6 514
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件贯钩,死亡現(xiàn)場離奇詭異募狂,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)角雷,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,334評(píng)論 3 398
  • 文/潘曉璐 我一進(jìn)店門祸穷,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人勺三,你說我怎么就攤上這事雷滚。” “怎么了吗坚?”我有些...
    開封第一講書人閱讀 167,643評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵祈远,是天一觀的道長。 經(jīng)常有香客問我商源,道長车份,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,495評(píng)論 1 296
  • 正文 為了忘掉前任牡彻,我火速辦了婚禮扫沼,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己缎除,他們只是感情好严就,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,502評(píng)論 6 397
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著器罐,像睡著了一般梢为。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上技矮,一...
    開封第一講書人閱讀 52,156評(píng)論 1 308
  • 那天抖誉,我揣著相機(jī)與錄音,去河邊找鬼衰倦。 笑死袒炉,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的樊零。 我是一名探鬼主播我磁,決...
    沈念sama閱讀 40,743評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼驻襟!你這毒婦竟也來了夺艰?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,659評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤沉衣,失蹤者是張志新(化名)和其女友劉穎郁副,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體豌习,經(jīng)...
    沈念sama閱讀 46,200評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡存谎,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,282評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了肥隆。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片既荚。...
    茶點(diǎn)故事閱讀 40,424評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖栋艳,靈堂內(nèi)的尸體忽然破棺而出恰聘,到底是詐尸還是另有隱情,我是刑警寧澤吸占,帶...
    沈念sama閱讀 36,107評(píng)論 5 349
  • 正文 年R本政府宣布晴叨,位于F島的核電站,受9級(jí)特大地震影響旬昭,放射性物質(zhì)發(fā)生泄漏篙螟。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,789評(píng)論 3 333
  • 文/蒙蒙 一问拘、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦骤坐、人聲如沸绪杏。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,264評(píng)論 0 23
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽蕾久。三九已至,卻和暖如春拌夏,著一層夾襖步出監(jiān)牢的瞬間僧著,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,390評(píng)論 1 271
  • 我被黑心中介騙來泰國打工障簿, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留盹愚,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,798評(píng)論 3 376
  • 正文 我出身青樓站故,卻偏偏與公主長得像皆怕,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子西篓,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,435評(píng)論 2 359