Error: parent directory is world writable but not sticky

在本地安装pyenv的时候,出现了如下的报错:

➜   brew install pyenv
==> Downloading https://github.com/yyuu/pyenv/archive/v20160310.tar.gz
Already downloaded: /Library/Caches/Homebrew/pyenv-20160310.tar.gz
Error: parent directory is world writable but not sticky
Please report this bug:
    https://git.io/brew-troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:92:in `mktmpdir'
/usr/local/Library/Homebrew/utils/fork.rb:6:in `safe_fork'
/usr/local/Library/Homebrew/formula_installer.rb:572:in `build'
/usr/local/Library/Homebrew/formula_installer.rb:231:in `install'
/usr/local/Library/Homebrew/cmd/install.rb:214:in `install_formula'
/usr/local/Library/Homebrew/cmd/install.rb:93:in `block in install'
/usr/local/Library/Homebrew/cmd/install.rb:93:in `each'
/usr/local/Library/Homebrew/cmd/install.rb:93:in `install'
/usr/local/Library/brew.rb:83:in `<main>'

解决方法:
先查看自己本机 /private/tmp 的文件夹的读写权限,在我的mac机器上如下:

➜  ls -ld /tmp
lrwxr-xr-x@ 1 root  wheel  11 11 13  2014 /tmp -> private/tmp
➜  ls -ld /private/tmp
drwxrwxrwt  13 root  wheel  442  1 18 09:07 /private/tmp

为了解决这个 'sticky' permission of /private/tmp ,需要执行如下的命令:
sudo chmod +t /private/tmp/

执行完之后,再安装就成功了:

➜  brew install pyenv
==> Downloading https://github.com/yyuu/pyenv/archive/v20160310.tar.gz
Already downloaded: /Library/Caches/Homebrew/pyenv-20160310.tar.gz
==> Caveats
To use Homebrew's directories rather than ~/.pyenv add to your profile:
  export PYENV_ROOT=/usr/local/var/pyenv

To enable shims and autocompletion add to your profile:
  if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
==> Summary
🍺  /usr/local/Cellar/pyenv/20160310: 469 files, 2M, built in 0 seconds
posted on 2017-01-18 09:15  mingaixin  阅读(1049)  评论(0编辑  收藏  举报