macos - 权限错误通过 osx 上的 vagrant 通过 Chef 通过 Homebrew 软件安装 ruby

标签 macos chef-infra homebrew vagrant

我正在尝试使用 homebrew 安装 ruby​​,使用 chef,由运行 mac os x 10.8.5 的 VMWare fusion VM 中的 vagrant 脚本运行。

在安装 ruby​​ 时,出现以下错误:

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of brew install  ruby ----
STDOUT: ==> Installing dependencies for ruby: pkg-config, readline, libyaml, openssl
==> Installing ruby dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-    0.28.mountain_lion.bottle.tar.gz
==> Pouring pkg-config-0.28.mountain_lion.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.28: 10 files, 636K
==> Installing ruby dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.2.4.mountain_lion.bottle.tar.gz
==> Pouring readline-6.2.4.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
🍺  /usr/local/Cellar/readline/6.2.4: 31 files, 1.6M
==> Installing ruby dependency: libyaml
==> Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
STDERR: Error: Permission denied - /var/root/Library/Logs
---- End output of brew install  ruby ----
Ran brew install  ruby returned 1

当我尝试使用 homebrew 安装 rbenv 时,我也遇到了这个错误,但安装 autoconf 失败了。我不确定它为什么要访问/var/root/。当我从 VM 运行“brew install autoconf”时,它安装正常。

我也尝试添加:

node.default['homebrew']['owner'] = 'vagrant'

我的 Recipe 只是为了确保 Homebrew 软件安装使用的是本地用户,但这没有任何区别。

我的 Recipe 是这样的:

# required for homebrew
bash "take-usr-local-ownership" do
    user "vagrant"
    cwd "/"
    code <<-EOH
    sudo mkdir -p /usr/local
    sudo chown -R `whoami`:staff /usr/local
    EOH
end

include_recipe 'homebrew'

# Install each of the packages using the `package` resource
%w(ruby).each do |package|
   package package
end

有什么想法吗?

最佳答案

chef 文档中的语法如下所示:

package "ruby" do
  action :install
end

所以这可能是问题的一部分。

另一件事是,谁安装了 homebrew?根? Vagrant ?我假设您必须在某个地方设置它,而不仅仅是谁使用 brew install

关于macos - 权限错误通过 osx 上的 vagrant 通过 Chef 通过 Homebrew 软件安装 ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19407747/

相关文章:

windows - 我可以将 knife.rb 作为参数传递给 knife 命令吗?

chef-infra - 从 Recipe 创建 Chef 数据包

macos - 如何在Mac OS上安装较新版本的make?

javascript - OSX 10.11 - 如何使用标志 --use-fake-device-for-media-stream 打开 chrome?

objective-c - NSAlert 框未显示

chef-infra - Chef : Use library function in attributes

homebrew - 使用 Homebrew 软件安装旧版本的 Pandoc (<2)

ruby - 无法找到 chromedriver 可执行文件。 ruby 。网络驱动程序。苹果

macos - 在mac中使用shell命令递归更改文件和文件夹的权限

macos - 在运行Gradle 'PATH'时指定 'exec'环境不起作用