vagrant init 不允许的操作

Operation not permitted with vagrant init

我正在尝试安装和配置 Vagrant,但我无法使用 vagrant init 创建测试目录。

我使用:

我的 Vagrant 版本:

# vagrant version
Installed Version: 1.9.5
Latest Version: 1.9.5
You're running an up-to-date version of Vagrant!

我的 Virtualbox 版本:

# vboxmanage --version
5.1.22r115126

我的 Ruby 版本:

$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

当我添加 Vagrant 测试框并创建测试目录时:

$ vagrant box add precise64 http://files.vagrantup.com/precise64.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'precise64' (v0) for provider: 
    box: Downloading: http://files.vagrantup.com/precise64.box
==> box: Successfully added box 'precise64' (v0) for 'virtualbox'!
$ vagrant init precise64
/opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/init/command.rb:69:in `initialize': Operation not permitted @ rb_sysopen - /usr/bin/Vagrantfile (Errno::EPERM)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/init/command.rb:69:in `open'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/init/command.rb:69:in `open'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/init/command.rb:69:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:308:in `cli'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/bin/vagrant:138:in `<main>'

我不明白为什么不允许该命令。我不确定它是否来自 ruby.

预先感谢您的帮助。

看起来您已经在 /usr/bin/ 下创建了 Vagrantfile。这是个坏主意

Vagrantfile 应该在你的项目目录的根目录下,它应该在你的 /Users/<name>/<.../project/...> 文件夹下

/user/bin 文件夹是 root 的保留文件夹,因此您将无权在此文件夹中写入,如果您继续从那里工作,只会以错误的配置结束