OSX, 10.9.2:
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ knife -v
Chef: 11.10.4
When I run:
$ knife ec2 server list
I get:
FATAL: Cannot find sub command for: 'ec2 server list'
The ec2 commands were moved to plugins in Chef 0.10
You can install the plugin with `(sudo) gem install knife-ec2
I have the gem installed:
sudo gem install knife-ec2
runs without error. And gem list shows that it is installed:
$ sudo gem list|grep knife-ec2
knife-ec2 (0.8.0)
The gem appears to be correctly installed here:
ls /Library/Ruby/Gems/2.0.0/gems/knife-ec2-0.8.0/
...
/usr/bin/knife on its own runs fine. Its quite likely it has something to do with where knife is looking for plugins, but what to do about it is unclear.
I had this or a similar problem when I installed the chefdk after I'd already had chef/knife/knife-ec2 installed via gems (in an attempt to get vagrant-berkshelf working, if you're wondering).
What I found is that when installing the chefdk the embedded chef ruby is used by the knife binary in your path, instead of the system ruby, so you have to install your gems to the chef embedded ruby.
On OSX I did it like this:
/opt/chefdk/embedded/bin/gem install knife-ec2
Edit: Looks like there's a chef command to do this already:
chef gem install knife-ec2
What's the output when you try running gem install knife
? gem
uses different paths when you run it with sudo
You can either run knife with sudo:
sudo knife ec2 server list
Or install gem as current user:
gem install knife-ec2
If the latter doesn't work, use RVM:
\curl -sSL https://get.rvm.io | bash
rvm install 2.0.0p247
gem install knife-ec2
You are installing things into your system ruby (which is ill-advised). You need to use sudo
before your knife
command in this instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With