From: dusty Date: 2008-12-14T16:01:03+09:00 Subject: Re: Command line utilities in rubygems? On Dec 14, 12:57 am, Ch Ba wrote: >  I have a small project that I'm working on and I would like the > executable to be put in the usr bin path and setup so that it can be > used as a command line utility automatically when installed using gem > install. How would I go about setting it up that way? I've been trying > to access the rubygems reference but it seems to be down. > -- > Posted viahttp://www.ruby-forum.com/. You can simply add it to the Rakefile. Here is an example Rakefile for a gem. require 'rubygems' Gem::manage_gems require 'rake/gempackagetask' spec = Gem::Specification.new do |s| s.name = "some_gem" s.version = "0.0.1" s.author = "The Author" s.email = "author@email.com" s.homepage = "http://www.author.com" s.platform = Gem::Platform::RUBY s.summary = "Some Gem" s.files = FileList["{bin,tests,lib}/**/*"].to_a s.require_path = "lib" s.autorequire = "some_gem" s.has_rdoc = true s.extra_rdoc_files = ["README.txt"] s.executables = ['the_executable'] s.add_dependency('dep1') s.add_dependency('dep2') end Rake::GemPackageTask.new(spec) do |pkg| pkg.need_tar = true end The part that says s.executables lists the files that will be installed into the path. In this case, its calling the file named the_executable, which would be in the bin subdirectory of the gem. So, my directory structure would be $ ls README.txt bin/ pkg/ Rakefile lib/ test/ $ ls bin/ the_executable* $ ls lib/ some_gem.rb $ ls test/ test_some_gem.rb Then to package it up, run rake gem. It will create a directory called pkg, and place the gem in there. Hope that is helpful. Dusty Doris