# Gems, put an executable script in path? like rails?

**URL:** <https://www.ruby-forum.com/t/gems-put-an-executable-script-in-path-like-rails/110075>\
**Category:** Ruby\
**Created:** [July 22, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/gems-put-an-executable-script-in-path-like-rails/110075 "2007-07-22T18:07:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [July 22, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/gems-put-an-executable-script-in-path-like-rails/110075/1 "2007-07-22T18:07:05Z")

</div>

Hey all, how do you put an executable in your path through gems… like  
when installing rails. you have a new command called “rails” what are  
they doing to do that? - Thanks

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [July 26, 2007, 12:46am UTC](https://www.ruby-forum.com/t/gems-put-an-executable-script-in-path-like-rails/110075/2 "2007-07-26T00:46:11Z")

</div>

When constructing your gem spec you need to include the bindir and the  
executables array. For example, here is the relevant code from the  
Rakefile for ActiveWarehouse ETL:

spec = Gem::Specification.new do |s|  
#snip  
s.bindir = “bin” # Use these for applications.  
s.executables = [‘etl’]  
s.default\_executable = “etl”

# snip

end

This would cause the script bin/etl to appear as an executable script  
on the system where the gem is installed. Inside my bin/etl script I  
usually delegate to code that’s actually in lib, however you may  
implement as you see fit. HTH.

V/r  
Anthony E.

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [July 26, 2007, 12:46am UTC](https://www.ruby-forum.com/t/gems-put-an-executable-script-in-path-like-rails/110075/3 "2007-07-26T00:46:24Z")

</div>

On 7/22/07, Anthony E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> end
> 
> > Hey all, how do you put an executable in your path through gems… like  
> > Current Location: Melbourne, FL

Thanks that worked perfectly.  
Aaron
