使用 Homebrew
安装 yarn
时遇到了 Error: parent directory is world writable but not sticky
brew install yarn
报错内容如下:
==> Downloading https://yarnpkg.com/downloads/1.17.0/yarn-v1.17.0.tar.gz
Already downloaded: /Users/lxf/Library/Caches/Homebrew/downloads/901b03db630ae5b508ecc153c742682c1257573cd9b12507393eac1d9bcec561--yarn-v1.17.0.tar.gz
Error: parent directory is world writable but not sticky
Please report this bug:
https://docs.brew.sh/Troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tmpdir.rb:93:in `mktmpdir'
/usr/local/Homebrew/Library/Homebrew/utils/fork.rb:30:in `safe_fork'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:746:in `build'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:322:in `install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:332:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:264:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:262:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:262:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
在 Homebrew GitHub上查到的解决方案:
Error: parent directory is world writable but not sticky #477
ls -ld /private/tmp
sudo chmod +t /tmp
执行完上述命令后即可成功安装