我正在尝试运行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
%
请指教。
答案1
为了解决“修复您的权限”错误,必须使用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
%