首页 > 解决方案 > Brew 已安装但未识别为“pkgbuild” (MacOS) 的安装后脚本中的命令

问题描述

Brew如果尚未安装,我有一个小的 shell 脚本可以安装。

#!/bin/bash -v

which -s brew
if [[ $? != 0 ]] ; then
    # Install Homebrew
    echo "Installing Brew..."
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    echo "I don't think brew is installed..."

else
    brew update
fi

当我将它作为独立的 shell 脚本运行时,该脚本运行良好。所以我尝试使用该pkgbuild实用程序创建一个包。但是一旦进入软件包,即使Brew安装了相同的脚本,也无法将 Brew 识别为命令。

到目前为止我尝试过的事情:-

  1. 我启用了安装日志,我可以看到
Sep 29 22:48:32 installd[80453]: ./postinstall:
    /tmp/PKInstallSandbox.42j7tU/Scripts/org.mybinary.0.0.4.sDKM7K/postinstall:
    line 16: brew: command not found
  1. /usr/local/bin/brew改为使用 Brew 二进制文件的绝对路径。这给了我一个不同的但仍然是一个错误。
Sep 30 10:01:22 installd[90276]: ./postinstall: Error: Running Homebrew as root is extremely dangerous and no longer supported.
Sep 30 10:01:22 installd[90276]: ./postinstall: As Homebrew does not drop privileges on installation you would be giving all
Sep 30 10:01:22 installd[90276]: ./postinstall: build scripts full access to your system.

我错过了什么?

谢谢!

标签: bashhomebrewzshpkgbuild

解决方案


推荐阅读