我弄乱了 sudo chown -R $(whoami) /usr/local/lib/pkgconfig 这一行。我如何解决它?

I messed up the line sudo chown -R $(whoami) /usr/local/lib/pkgconfig. How do I fix it?

尝试使用 brew 下载内容时,我收到一条消息:

Error: The following directories are not writable by your user:
/usr/local/lib/pkgconfig

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/lib/pkgconfig

And make sure that your user has write permission.
  chmod u+w /usr/local/lib/pkgconfig

我误以为我需要用我的名字替换 $(whoami) 然后我得到了一个警告 zsh: command not found "myname" but asked for a password.没多想就输入了密码

然后我输入密码后得到了这个:

usage: chown [-fhnv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhnv] [-R [-H | -L | -P]] :group file ...

在那之后,我意识到我不应该更换 $(whoami)。我该如何解决这个问题?

我用正确的 $(whoami) 再次尝试 运行ning 该行,但没有任何反应。我可以继续吗 运行

chmod u+w /usr/local/lib/pkgconfig

或者在 运行 下一行之前尝试解决这个问题?

这段文字:

usage: chown [-fhnv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhnv] [-R [-H | -L | -P]] :group file ...

只是在说明 chown 命令的工作原理。

I tried running that line again with correct $(whoami) but nothing happened.

没关系,您应该看不到任何输出。

您现在应该可以 运行 以下命令:chmod u+w /usr/local/lib/pkgconfig