# RubyGems 0.9.5 ignoring spec.bindir

**URL:** <https://www.ruby-forum.com/t/rubygems-0-9-5-ignoring-spec-bindir/122609>\
**Category:** Ruby\
**Created:** [December 10, 2007, 4:03am UTC](https://www.ruby-forum.com/t/rubygems-0-9-5-ignoring-spec-bindir/122609 "2007-12-10T04:03:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 10, 2007, 4:03am UTC](https://www.ruby-forum.com/t/rubygems-0-9-5-ignoring-spec-bindir/122609/1 "2007-12-10T04:03:20Z")

</div>

Hello,

I want to make a gem for a small (\< 200 lines) project of mine. The  
entire project is stored in one Ruby source file, so I don’t want to  
create a separate “bin/” directory. I read about RubyGems’ bindir  
parameter which allows you to override the “bin/” directory requirement  
and basically put your executable anywhere inside your project  
directory.

The problem is that RubyGems 0.9.5 is ignoring my

spec.bindir = ‘.’

assignment and looking for a “bin/” directory instead.

I tried using

spec.bindir = nil

but that does not work either.

* * *

Here is a complete example to reproduce the problem:

$ ls -l  
-rw-r–r-- 1 sun sun 371 2007-12-09 18:53 Rakefile  
-rwxr-xr-x 1 sun sun 39 2007-12-09 18:53 foobar\*

$ ./foobar  
hello world

$ cat foobar  
#!/usr/bin/env ruby  
puts “hello world”

$ cat Rakefile  
require ‘rake/gempackagetask’

spec = Gem::Specification.new do |s|  
s.name = ‘foobar’  
s.version = ‘0’  
s.summary = ‘summary’  
s.files = ‘foobar’  
s.executables = ‘foobar’  
s.bindir = ‘.’ # our executable is not inside ‘bin/’  
end

# does nothing unless block given, dunno why…

Rake::GemPackageTask.new(spec) do end

$ rake -T  
(in /home/sun/lab/gemspec)  
rake clobber\_package # Remove package products  
rake gem # Build the gem file foobar-0.gem  
rake package # Build all the packages  
rake repackage # Force a rebuild of the package files

$ rake gem  
(in /home/sun/lab/gemspec)  
Successfully built RubyGem  
Name: foobar  
Version: 0  
File: foobar-0.gem

$ gem install pkg/foobar-0.gem -i my\_out\_dir  
ERROR: While executing gem … (Errno::ENOENT)  
No such file or directory -  
/home/sun/lab/gemspec/my\_out\_dir/gems/foobar-0/bin/foobar

See this error? Why is it looking for a “bin/” directory when I  
assigned spec.bindir?!

Thanks for your consideration.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [December 10, 2007, 7:44pm UTC](https://www.ruby-forum.com/t/rubygems-0-9-5-ignoring-spec-bindir/122609/2 "2007-12-10T19:44:50Z")

</div>

Suraj K. wrote:

> The problem is that RubyGems 0.9.5 is ignoring my
> 
> spec.bindir = ‘.’
> 
> assignment and looking for a “bin/” directory instead.

I filed a bug report about this on the RubyGems bug tracker:  
[http://rubyforge.org/tracker/index.php?func=detail&aid=16202&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=16202&group_id=126&atid=575)
