错误:无法清理旧桶!修复您的权限:

ale*_*xus 3 homebrew file-permissions

我正在尝试运行brew cleanup,但遇到以下错误:

错误:无法清理旧桶!修复您的权限:


% brew cleanup
Removing: /usr/local/Cellar/ansible/6.6.0... (28,050 files, 364MB)
Warning: Directory not empty @ dir_s_rmdir - /usr/local/Cellar/ansible/6.6.0
==> This operation has freed approximately 364MB of disk space.
Error: Could not cleanup old kegs! Fix your permissions on:
  /usr/local/Cellar/ansible/6.6.0
% echo $?
1
%
Run Code Online (Sandbox Code Playgroud)

请指教。

ale*_*xus 9

要解决“修复您的权限”错误,必须使用chown(8)(更改文件所有者和组)以及sudo(8)(以另一用户身份执行命令),如下所示:

% sudo chown -R $(whoami) $(brew --prefix)/*
% echo $?
0
% brew cleanup
Removing: /usr/local/Cellar/ansible/6.6.0... (28,050 files, 364MB)
==> This operation has freed approximately 364MB of disk space.
% echo $?
0
%
Run Code Online (Sandbox Code Playgroud)