【问题标题】:I messed up the line sudo chown -R $(whoami) /usr/local/lib/pkgconfig. How do I fix it?我搞砸了 sudo chown -R $(whoami) /usr/local/lib/pkgconfig.我如何解决它?
【发布时间】:2021-11-15 14:52:42
【问题描述】:

尝试使用 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" 但要求输入密码。输入密码之前我没有多想。

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

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

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

我尝试使用正确的 $(whoami) 再次运行该行,但什么也没发生。我可以继续跑吗

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

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

【问题讨论】:

    标签: homebrew


    【解决方案1】:

    这段文字:

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

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

    我尝试使用正确的 $(whoami) 再次运行该行,但没有任何反应。

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

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

    【讨论】:

      猜你喜欢
      • 2015-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-18
      相关资源
      最近更新 更多