# OptionParser::MissingArgument ruby error chef 10.12

**URL:** <https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155>\
**Category:** Chef Infra (archive)\
**Created:** [September 5, 2012, 8:11pm UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155 "2012-09-05T20:11:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Dunphy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tim_dunphy/32/410_2.png) [@Tim\_Dunphy](https://discourse.chef.io/u/Tim_Dunphy)\
**Post date:** [September 5, 2012, 8:11pm UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155/1 "2012-09-05T20:11:04Z")

</div>

Hello,

I come from using puppet to manage our conf files and am very new to chef,  
but looking forward to diving in here since it seems like a great tool.

I’ve just installed Chef 10.12 on centos 5.6 using a gem install.

/usr/bin/gem install chef ohai --no-rdoc --no-ri

When I go to run chef-solo for the first time I am running into a ruby  
error with the following output:

[root@cloud:~] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
/usr/lib/ruby/1.8/optparse.rb:451:in `parse': missing argument: -c (OptionParser::MissingArgument) from /usr/lib/ruby/1.8/optparse.rb:1295:in`parse\_in\_order’  
from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in`parse\_in\_order’  
from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in`permute!'  
from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' from /usr/lib/ruby/gems/1.8/gems/mixlib-cli-1.2.2/lib/mixlib/cli.rb:154:in`parse\_options’  
from  
/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/application.rb:75:in  
`configure_chef' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:62:in`reconfigure’  
from  
/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/…/lib/chef/application/solo.rb:134:in  
`reconfigure' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:68:in`run’  
from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo:25

I tried doing a : gem install OptionParser

But that hasn’t changed the output.

I was just wondering if I might be missing a ruby module and/or what I  
would need to install to get chef running in this host for the first time.

Thanks  
Tim

–  
GPG me!!

gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) --recv-keys F186197B

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [September 5, 2012, 9:00pm UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155/2 "2012-09-05T21:00:01Z")

</div>

On Wednesday, September 5, 2012 at 1:11 PM, Tim Dunphy wrote:

> Hello,
> 
> I come from using puppet to manage our conf files and am very new to chef, but looking forward to diving in here since it seems like a great tool.
> 
> I've just installed Chef 10.12 on centos 5.6 using a gem install.
> 
> /usr/bin/gem install chef ohai --no-rdoc --no-ri
> 
> When I go to run chef-solo for the first time I am running into a ruby error with the following output:
> 
> [root@cloud:~] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
> /usr/lib/ruby/1.8/optparse.rb:451:in `parse': missing argument: -c (OptionParser::MissingArgument) from /usr/lib/ruby/1.8/optparse.rb:1295:in `parse\_in\_order'  
> from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse\_in\_order'  
> from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'  
> from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' from /usr/lib/ruby/gems/1.8/gems/mixlib-cli-1.2.2/lib/mixlib/cli.rb:154:in `parse\_options'  
> from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:75:in `configure_chef' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:62:in `reconfigure'  
> from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application/solo.rb:134:in `reconfigure' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:68:in `run'  
> from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo:25
> 
> I tried doing a : gem install OptionParser
> 
> But that hasn't changed the output.
> 
> I was just wondering if I might be missing a ruby module and/or what I would need to install to get chef running in this host for the first time.
> 
> Thanks  
> Tim
> 
> --  
> GPG me!!
> 
> gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) ([http://pool.sks-keyservers.net](http://pool.sks-keyservers.net)) --recv-keys F186197B

The `-c` option requires an argument (the path to the desired config file). I seem to remember this having a better error message in the past, I'll look into it.

--  
Daniel DeLeo

---

<div class="post-metadata">

**Author:** ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)\
**Post date:** [September 6, 2012, 12:43pm UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155/3 "2012-09-06T12:43:26Z")

</div>

> The `-c` option requires an argument (the path to the desired  
> config file). I seem to remember this having a better error message in  
> the past, I'll look into it.
> 
> --  
> Daniel  
> DeLeo

/usr/lib/ruby/1.8/optparse.rb:451:in `parse': missing argument:  
-c (OptionParser::MissingArgument)

Well this sounds a quiet correct  
error message IMHO, I can't see a better way to say Hey guy, you forgot  
to give me something after -c

But maybe I'm too used to stacktraces  
...

---

<div class="post-metadata">

**Author:** ![Tim\_Dunphy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tim_dunphy/32/410_2.png) [@Tim\_Dunphy](https://discourse.chef.io/u/Tim_Dunphy)\
**Post date:** [September 7, 2012, 3:44am UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155/4 "2012-09-07T03:44:37Z")

</div>

Hi there,

> The `-c` option requires an argument (the path to the desired config  
> file). I seem to remember this having a better error \>message in the past,  
> I'll look into it.

That's an awesome tip! Thanks and I appreciate you looking into this as  
well as getting me a bit further down the road of actually using chef as  
opposed to puppet. I'm fairly used to using puppet at this point but I'm  
excited to learn chef!

So what I've done is cook up (excuse the pun) a little test where I would  
remove the 'vim-enhanced' package via yum and see if I could get chef to  
install it.

So the run went like this:

[root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo  
-c /var/chef/cookbooks/jf-beta/recipes/default.rb  
[2012-09-06T21:01:21-04:00] INFO: \*\*\* Chef 10.12.0 \*\*\*  
[2012-09-06T21:01:23-04:00] INFO: Run List is   
[2012-09-06T21:01:23-04:00] INFO: Run List expands to   
[2012-09-06T21:01:23-04:00] INFO: Starting Chef Run for [cloud.jokefire.com](http://cloud.jokefire.com)  
[2012-09-06T21:01:23-04:00] INFO: Running start handlers  
[2012-09-06T21:01:23-04:00] INFO: Start handlers complete.  
[2012-09-06T21:01:23-04:00] INFO: Chef Run complete in 0.005195 seconds  
[2012-09-06T21:01:23-04:00] INFO: Running report handlers  
[2012-09-06T21:01:23-04:00] INFO: Report handlers complete

And this is the simple recipe I tried:

[root@cloud:/opt] #cat /var/chef/cookbooks/jf-beta/recipes/default.rb  
package("vim-enhanced")

Sadly, I had a look afterward to realize that 'vim-enhanced' had not  
actually been installed.

[root@cloud:/opt] #rpm -qa | grep vim  
vim-common-7.0.109-7.el5  
vim-minimal-7.0.109-7.el5

I also tried creating a mysql database this way:

[root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo  
-c /var/chef/cookbooks/create\_mysql\_db/recipes/default.rb  
[2012-09-06T23:37:13-04:00] INFO: \*\*\* Chef 10.12.0 \*\*\*  
[2012-09-06T23:37:14-04:00] INFO: Run List is   
[2012-09-06T23:37:14-04:00] INFO: Run List expands to   
[2012-09-06T23:37:14-04:00] INFO: Starting Chef Run for [cloud.jokefire.com](http://cloud.jokefire.com)  
[2012-09-06T23:37:14-04:00] INFO: Running start handlers  
[2012-09-06T23:37:14-04:00] INFO: Start handlers complete.  
[2012-09-06T23:37:14-04:00] INFO: Chef Run complete in 0.005601 seconds  
[2012-09-06T23:37:14-04:00] INFO: Running report handlers  
[2012-09-06T23:37:14-04:00] INFO: Report handlers complete

This is the recipe that tries to do that:

[root@cloud:/opt] #cat  
/var/chef/cookbooks/create\_mysql\_db/recipes/default.rb  
bash "really awesome way to create a mysql database from chef using the  
bash method" do

# dont if the db already exists

not\_if("/usr/bin/mysql -uroot -psecretsauce -e'show databases' | grep  
#{node[:create\_mysql\_db][chef\_test]}", :user =\> 'bluethundr')

# run as my user

user "bluethundr"

# a heredoc of the code to execute, note the node hash is created from

the JSON file  
code \<\<-HEY\_BRO\_EOM  
mysql -uroot --psecretsauce -e 'create database  
#{node[:create\_mysql\_db][:chef\_test]}'  
HEY\_BRO\_EOM

end

Result:

mysql\> show databases like 'chef%';  
Empty set (0.00 sec)

I was just wondering if there might be some docs to get me past this stage  
or even just some basic advice.

Thanks  
Tim

On Wed, Sep 5, 2012 at 5:00 PM, Daniel DeLeo [dan@kallistec.com](mailto:dan@kallistec.com) wrote:

> On Wednesday, September 5, 2012 at 1:11 PM, Tim Dunphy wrote:
> 
> Hello,
> 
> I come from using puppet to manage our conf files and am very new to  
> chef, but looking forward to diving in here since it seems like a great  
> tool.
> 
> I've just installed Chef 10.12 on centos 5.6 using a gem install.
> 
> /usr/bin/gem install chef ohai --no-rdoc --no-ri
> 
> When I go to run chef-solo for the first time I am running into a ruby  
> error with the following output:
> 
> [root@cloud:~] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
> /usr/lib/ruby/1.8/optparse.rb:451:in `parse': missing argument: -c (OptionParser::MissingArgument) from /usr/lib/ruby/1.8/optparse.rb:1295:in `parse\_in\_order'  
> from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse\_in\_order'  
> from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'  
> from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' from /usr/lib/ruby/gems/1.8/gems/mixlib-cli-1.2.2/lib/mixlib/cli.rb:154:in `parse\_options'  
> from  
> /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:75:in  
> `configure_chef' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:62:in `reconfigure'  
> from  
> /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application/solo.rb:134:in  
> `reconfigure' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:68:in `run'  
> from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo:25

> I tried doing a : gem install OptionParser
> 
> But that hasn't changed the output.
> 
> I was just wondering if I might be missing a ruby module and/or what I  
> would need to install to get chef running in this host for the first time.
> 
> Thanks  
> Tim
> 
> --  
> GPG me!!
> 
> gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) --recv-keys F186197B
> 
> The `-c` option requires an argument (the path to the desired config  
> file). I seem to remember this having a better error message in the past,  
> I'll look into it.
> 
> --  
> Daniel DeLeo

--  
GPG me!!

gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) --recv-keys F186197B

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [September 7, 2012, 3:55am UTC](https://discourse.chef.io/t/optionparser-missingargument-ruby-error-chef-10-12/3155/5 "2012-09-07T03:55:26Z")

</div>

Yo,

On 7 September 2012 15:44, Tim Dunphy [bluethundr@gmail.com](mailto:bluethundr@gmail.com) wrote:

> Hi there,
> 
> > The `-c` option requires an argument (the path to the desired config file).  
> > I seem to remember this having a better error \>message in the past, I'll  
> > look into it.
> 
> That's an awesome tip! Thanks and I appreciate you looking into this as well  
> as getting me a bit further down the road of actually using chef as opposed  
> to puppet. I'm fairly used to using puppet at this point but I'm excited to  
> learn chef!
> 
> So what I've done is cook up (excuse the pun) a little test where I would  
> remove the 'vim-enhanced' package via yum and see if I could get chef to  
> install it.
> 
> So the run went like this:
> 
> [root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
> /var/chef/cookbooks/jf-beta/recipes/default.rb

```
-c, --config CONFIG The configuration file to use

```

It appears that you are attempting to pass in a single recipe as  
Chef's configuration file. This will not work.

I'd imagine what you would like to do is: configure Chef to be aware  
of your cookbook path and instruct chef-solo to run the recipe.

Here is the documentation regarding all available Chef Configuration  
Settings: [http://wiki.opscode.com/display/chef/Chef+Configuration+Settings](http://wiki.opscode.com/display/chef/Chef+Configuration+Settings)

You'll want something like:

(solo.rb)

cookbook\_path ["/var/chef/cookbooks"]

Now, you'll want to instruct chef-solo to run the default recipe in  
the jf-beta (?) cookbook, like so:

(dna.json)

{ "run\_list": ["recipe[jf-beta::default]" ] }

And then, hey presto..

chef-solo -c solo.rb -j dna.json

In any case, despite all of the above, this is all terribly well  
documented on the Opscode wiki; here is a "fast start guide"  
[http://wiki.opscode.com/display/chef/Fast+Start+Guide](http://wiki.opscode.com/display/chef/Fast+Start+Guide)

It's worth mentioning there is a huge repository of community  
supported (and Opscode!) cookbooks at [http://community.opscode.com/](http://community.opscode.com/)

Cheers,

AJ

> [2012-09-06T21:01:21-04:00] INFO: \*\*\* Chef 10.12.0 \*\*\*  
> [2012-09-06T21:01:23-04:00] INFO: Run List is   
> [2012-09-06T21:01:23-04:00] INFO: Run List expands to   
> [2012-09-06T21:01:23-04:00] INFO: Starting Chef Run for [cloud.jokefire.com](http://cloud.jokefire.com)  
> [2012-09-06T21:01:23-04:00] INFO: Running start handlers  
> [2012-09-06T21:01:23-04:00] INFO: Start handlers complete.  
> [2012-09-06T21:01:23-04:00] INFO: Chef Run complete in 0.005195 seconds  
> [2012-09-06T21:01:23-04:00] INFO: Running report handlers  
> [2012-09-06T21:01:23-04:00] INFO: Report handlers complete
> 
> And this is the simple recipe I tried:
> 
> [root@cloud:/opt] #cat /var/chef/cookbooks/jf-beta/recipes/default.rb  
> package("vim-enhanced")
> 
> Sadly, I had a look afterward to realize that 'vim-enhanced' had not  
> actually been installed.
> 
> [root@cloud:/opt] #rpm -qa | grep vim  
> vim-common-7.0.109-7.el5  
> vim-minimal-7.0.109-7.el5
> 
> I also tried creating a mysql database this way:
> 
> [root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
> /var/chef/cookbooks/create\_mysql\_db/recipes/default.rb  
> [2012-09-06T23:37:13-04:00] INFO: \*\*\* Chef 10.12.0 \*\*\*  
> [2012-09-06T23:37:14-04:00] INFO: Run List is   
> [2012-09-06T23:37:14-04:00] INFO: Run List expands to   
> [2012-09-06T23:37:14-04:00] INFO: Starting Chef Run for [cloud.jokefire.com](http://cloud.jokefire.com)  
> [2012-09-06T23:37:14-04:00] INFO: Running start handlers  
> [2012-09-06T23:37:14-04:00] INFO: Start handlers complete.  
> [2012-09-06T23:37:14-04:00] INFO: Chef Run complete in 0.005601 seconds  
> [2012-09-06T23:37:14-04:00] INFO: Running report handlers  
> [2012-09-06T23:37:14-04:00] INFO: Report handlers complete
> 
> This is the recipe that tries to do that:
> 
> [root@cloud:/opt] #cat  
> /var/chef/cookbooks/create\_mysql\_db/recipes/default.rb  
> bash "really awesome way to create a mysql database from chef using the bash  
> method" do
> 
> # dont if the db already exists
> 
> not\_if("/usr/bin/mysql -uroot -psecretsauce -e'show databases' | grep  
> #{node[:create\_mysql\_db][chef\_test]}", :user =\> 'bluethundr')
> 
> # run as my user
> 
> user "bluethundr"
> 
> # a heredoc of the code to execute, note the node hash is created from the
> 
> JSON file  
> code \<\<-HEY\_BRO\_EOM  
> mysql -uroot --psecretsauce -e 'create database  
> #{node[:create\_mysql\_db][:chef\_test]}'  
> HEY\_BRO\_EOM
> 
> end
> 
> Result:
> 
> mysql\> show databases like 'chef%';  
> Empty set (0.00 sec)
> 
> I was just wondering if there might be some docs to get me past this stage  
> or even just some basic advice.
> 
> Thanks  
> Tim
> 
> On Wed, Sep 5, 2012 at 5:00 PM, Daniel DeLeo [dan@kallistec.com](mailto:dan@kallistec.com) wrote:
> 
> > On Wednesday, September 5, 2012 at 1:11 PM, Tim Dunphy wrote:
> > 
> > Hello,
> > 
> > I come from using puppet to manage our conf files and am very new to  
> > chef, but looking forward to diving in here since it seems like a great  
> > tool.
> > 
> > I've just installed Chef 10.12 on centos 5.6 using a gem install.
> > 
> > /usr/bin/gem install chef ohai --no-rdoc --no-ri
> > 
> > When I go to run chef-solo for the first time I am running into a ruby  
> > error with the following output:
> > 
> > [root@cloud:~] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c  
> > /usr/lib/ruby/1.8/optparse.rb:451:in `parse': missing argument: -c (OptionParser::MissingArgument) from /usr/lib/ruby/1.8/optparse.rb:1295:in `parse\_in\_order'  
> > from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse\_in\_order'  
> > from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'  
> > from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' from /usr/lib/ruby/gems/1.8/gems/mixlib-cli-1.2.2/lib/mixlib/cli.rb:154:in `parse\_options'  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:75:in  
> > `configure_chef' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:62:in `reconfigure'  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application/solo.rb:134:in  
> > `reconfigure' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:68:in `run'  
> > from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo:25
> 
> > I tried doing a : gem install OptionParser
> > 
> > But that hasn't changed the output.
> > 
> > I was just wondering if I might be missing a ruby module and/or what I  
> > would need to install to get chef running in this host for the first time.
> > 
> > Thanks  
> > Tim
> > 
> > --  
> > GPG me!!
> > 
> > gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) --recv-keys F186197B
> > 
> > The `-c` option requires an argument (the path to the desired config  
> > file). I seem to remember this having a better error message in the past,  
> > I'll look into it.
> > 
> > --  
> > Daniel DeLeo
> 
> --  
> GPG me!!
> 
> gpg --keyserver [pool.sks-keyservers.net](http://pool.sks-keyservers.net) --recv-keys F186197B
