I have been pulling my hair out for about a full 24 hours now. I have searched high and low looking for a solution. I have tried just about everything that I could find.
What i am trying to do: Install the ec2 plugin for the 'knife' program; an invaluable tool for interacting with a Chef server.
What happens
everything comes back with rainbows and unicorns. module installed
. Module is not available, nor can I find any evidence that it was successfully installed.
My Environment: Details are at the end of this post. high level: OSX 10.9.2 w/ BREW installed as well as Xcode 5.1
It's easiest to just show my problem:
Trying to install the gem
bash-3.2$ sudo -E gem install knife-ec2
Fetching: knife-windows-0.5.15.gem (100%)
Successfully installed knife-windows-0.5.15
Fetching: knife-ec2-0.8.0.gem (100%)
Successfully installed knife-ec2-0.8.0
Parsing documentation for knife-windows-0.5.15
Installing ri documentation for knife-windows-0.5.15
Parsing documentation for knife-ec2-0.8.0
Installing ri documentation for knife-ec2-0.8.0
2 gems installed
Fanstastic! It's been installed. Neat. That was easy! Oh, wait
bash-3.2$ knife ec2
FATAL: Cannot find sub command for: 'ec2'
The ec2 commands were moved to plugins in Chef 0.10
You can install the plugin with `(sudo) gem install knife-ec2
bash-3.2$ sudo knife ec2
FATAL: Cannot find sub command for: 'ec2'
The ec2 commands were moved to plugins in Chef 0.10
You can install the plugin with `(sudo) gem install knife-ec2
It's not available as root or regular user.
After more reading, (see, in part, here How to install knife-ec2 ), I tried a different approach
bash-3.2$ cd /opt/chef/embedded/bin/
bash-3.2$ sudo ./gem install knife-ec2
Building native extensions. This could take a while...
ERROR: Error installing knife-ec2:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.1.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.1.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26)...
checking for libxml/parser.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chef/embedded/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:983:in `block in find_header'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:982:in `find_header'
from extconf.rb:166:in `<main>'
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
trying the same approach as above, but with regular user access
bash-3.2$ ./gem install knife-ec2
Fetching: nokogiri-1.6.1.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /opt/chef/embedded/lib/ruby/gems/1.9.1 directory.
more information about my ruby setup
bash-3.2$ rvm -v
rvm 1.25.22 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
bash-3.2$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Below is an env
listing. Hopefully this will be helpful to you.
bash-3.2$ env
TERM_PROGRAM=iTerm.app
SHELL=/bin/bash
TERM=xterm
TMPDIR=/var/folders/m7/x_zjzw412rvg7rb_gz8135m5_0892r/T/
Apple_PubSub_Socket_Render=/tmp/launch-bEYnaW/Render
CDC_PREW2KHOST=<xOMITTEDx>
AWS_AVAILABILITY_REGION=us-west-1
OLDPWD=/tmp
COM_GOOGLE_CHROME_FRAMEWORK_SERVICE_PROCESS/USERS/<xOMITTEDx>/LIBRARY/APPLICATION_SUPPORT/GOOGLE/CHROME_SOCKET=/tmp/launch-KSHJfT/ServiceProcessSocket
USER=<xOMITTEDx>
AWS_AVAILABILITY_ZONE=us-west-1a
SSH_AUTH_SOCK=/tmp/launch-lUS8iG/Listeners
__CF_USER_TEXT_ENCODING=0x54042458:0:0
AWS_SSH_KEY_PAIR=<xOMITTEDx>
PATH=/Users/<xOMITTEDx>/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
__CHECKFIX1436934=1
PWD=/tmp/libxslt-1.1.28
EDITOR=/usr/bin/nano
AWS_SECRET_ACCESS_KEY=<xOMITTEDx>
LANG=en_US.UTF-8
ITERM_PROFILE=Default
USER_PRINCIPAL_NAME=<xOMITTEDx>@CORP.ACXIOM.NET
CDC_JOINED_DC=fsccorpdc01.corp.acxiom.net
AWS_ACCESS_KEY_ID=<xOMITTEDx>
HOME=/Users/<xOMITTEDx>
COLORFGBG=7;0
SHLVL=2
CDC_JOINED_SITE=<xOMITTEDx>
ITERM_SESSION_ID=w0t1p0
LOGNAME=<xOMITTEDx>
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
CDC_JOINED_ZONE=DC=corp,DC=acxiom,DC=net
CDC_LOCALHOST=<xOMITTEDx>0214mac.corp.acxiom.net
AWS_ACCESS_KEY=<xOMITTEDx>
AWS_SECRET_KEY=<xOMITTEDx>
CDC_JOINED_DOMAIN=corp.acxiom.net
_=/usr/bin/env
bash-3.2$ sudo env
TERM=xterm
SSH_AUTH_SOCK=/tmp/launch-lUS8iG/Listeners
__CF_USER_TEXT_ENCODING=0x54042458:0:0
PATH=/Users/<xOMITTEDx>/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
EDITOR=/usr/bin/nano
LANG=en_US.UTF-8
HOME=/Users/<xOMITTEDx>
COLORFGBG=7;0
SHELL=/bin/bash
MAIL=/var/mail/root
LOGNAME=root
USER=root
USERNAME=root
SUDO_COMMAND=/usr/bin/env
SUDO_USER=<xOMITTEDx>
SUDO_UID=1409557592
SUDO_GID=20
The solution was to use virtual box and install a bare-bones ubuntu image.