Skip to content
This repository has been archived by the owner on Dec 26, 2017. It is now read-only.

chefdk, vagrant, berkshelf,rbenv mac osx #269

Open
ghost opened this issue Feb 25, 2015 · 2 comments
Open

chefdk, vagrant, berkshelf,rbenv mac osx #269

ghost opened this issue Feb 25, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 25, 2015

hi,

i spent the last 2 days on trying to get the berks plugin to function correctly with vagrant. i can get it to work under linux where i only have the system ruby at 2.2.0 even that took a while in that i couldn't use the berks in my ruby distro, but rather needed to use the berks in the chefdk kit.

now that i'm on my mac, i have same problem but the berks in the chefdk is giving an illegal instruction. however, i have rbenv installed and from googling, this is common, but nobody has an answer to fix it. people mention modifying the PATH, which is what i did, but again berks fails on a segmentation fault. there is definitely some confusion with rbenv and the embedded ruby that comes with chefdk. if somebody could chime in that would be great.

  1. this is with chefdk berks
    => vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    The following berks command failed to execute:

/opt/chefdk/bin/berks --version --format json
The stdout and stderr are shown below:

stdout:
stderr:
~/Desktop/projects/vagrant_mean master
=> /opt/chefdk/bin/berks --version --format json
Illegal instruction: 4
[user@SFM1C8F1G3L]
~/Desktop/projects/vagrant_mean master
=> vagrant plugin list
vagrant-berkshelf (4.0.3)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.3)

  1. This is with the rbenv berks which works if you run on the cli, but vagrant seems to believe it fails. it complains the berkshelf is not found, but it is :(

which berks
/Users/user/.rbenv/shims/berks
[user@SFM1C8F1G3L]
~/Desktop/projects/vagrant_mean master
=> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
The following berks command failed to execute:

/Users/user/.rbenv/shims/berks --version --format json
The stdout and stderr are shown below:

stdout:
stderr: /Users/user/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:315:in to_specs': Could not find 'berkshelf' (>= 0) among 51 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/user/.vagrant.d/gems:/opt/vagrant/bin/../embedded/gems', execute gem env for more information from /Users/user/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:324:in to_spec' from /Users/user/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:ingem' from /Users/user/.rbenv/versions/2.2.0/bin/berks:22:in'

It appears that you are not using the ChefDK. Please note that Vagrant Berkshelf
works best when used with the ChefDK, and other installation methods are not
officially supported.

Please download and install the latest version of the ChefDK from:

https://downloads.chef.io/chef-dk
and follow the installation instructions. Do not forget to add the ChefDK to
your PATH.

[user@SFM1C8F1G3L]
~/Desktop/projects/vagrant_mean master
=> /Users/user/.rbenv/shims/berks --version --format json
{
"version": "3.2.3"
}

~/Desktop/projects/vagrant_mean master
=> gem list

LOCAL GEMS *
addressable (2.3.7)
berkshelf (3.2.3)
berkshelf-api-client (1.2.1)
bigdecimal (1.2.6)
buff-config (1.0.1)

@rmldsky
Copy link

rmldsky commented May 26, 2015

I'm also having this problem on OSX with rbenv. Would appreciate if someone has solution/workaround to share.

@sworisbreathing
Copy link

I've installed the rbenv-chefdk plugin and set it up to use chefdk as the local ruby for my repository.

Basically, I followed the installation steps from the plugin's readme, but instead of running rbenv shell chefdk, I ran rbenv local chefdk in the repository root (where my Vagrantfile is). This way, I ensure that any ruby commands I run from inside my vagrant/chef repository will use chefdk's ruby, even if I fire up a new shell.

Mac OS 10.10.4, rbenv 0.4.0 (installed via homebrew), chefdk 0.6.2-1 (installed via homebrew cask), vagrant 1.7.4 (installed via homebrew cask), rbenv-chefdk (installed via plugin instructions, except as noted above)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants