根据Homebrew安装说明,可以使用以下命令进行安装:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
这可行,但需要用户输入两次;确认安装并在脚本调用的 sudo 提示符中:
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /usr/local
Password:
Homebrew 没有无人值守安装的参数,因此我能想到的唯一选择是以编程方式输入预期数据。我尝试使用expect
,但我不太能理解正确的语法:
$ expect -c 'spawn ruby -e \"\$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)\";expect "RETURN";send "\n"'
ruby: invalid option -f (-h will show valid options) (RuntimeError)
send: spawn id exp7 not open
while executing
"send "\n""
我究竟做错了什么?
现已正式支持无人值守安装https://docs.brew.sh/Installation#unattended-installation https://docs.brew.sh/Installation#unattended-installation:
如果您想要非交互式运行 Homebrew 安装程序而不提示输入密码(例如在自动化脚本中),请在前面添加NONINTERACTIVE=1
到安装命令。
$ NONINTERACTIVE=1 /bin/bash -c \
"$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)