bash - 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 识别为命令。
到目前为止我尝试过的事情:-
- 我启用了安装日志,我可以看到
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
/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.
我错过了什么?
谢谢!
解决方案
推荐阅读
- c# - 分层 c# 递归排序
- javascript - 如何使用 Jquery 选择具有特定类的父级的子级?
- java - 有没有办法告诉java线程重新加载缓存?
- php - 如何处理在“then”阶段有很多步骤的小黄瓜场景
- python - 为什么在这个答案中使用 set()
- javascript - 如何获取动态创建的 ID?
- android - 如何获得可以与 RxAndroid 一起使用的普通字符串作为改造响应?
- node.js - 在passportJS中从未使用Google Strategy调用deserializeUser函数
- python - python:tkinter 单选按钮和按钮设置文本属性,但在 Mac 上不显示任何内容
- ruby-on-rails - 每次使用rails加载后触发javascript ajax部分