Run bundle install with the –binstubs option

It’s been a little while that I have decided to always extract my gem binaries into my rails application “bin” path. That way, I always execute binaries by specifying the relative path. For example “./bin/rails g model User”. At first I wasn’t sure about the idea. I was like: “Wait a minute! I will have to type “./bin/” all the time?! It will get annoying really fast!”. This turned to be an unfounded fear. Having to type “./bin/rails” or “./bin/rake” is a good thing and it feels really natural. When you do this, there is no magic involved: you know exactly WHICH binary is going to be executed.

Isn’t it exactly like typing “bundle exec” ?

Yes, you’re right… it’s more or less the same thing. But I find that having to type “./bin/” is even more obvious. Believe me, you will get the hang of it quickly. Anyway, with TAB completion, it’s not like you have to type “./bin” really. It will look more like “./b” then TAB. It becomes second nature really fast.

Wow! This is the discovery of the century! I’m sold, how can I do this ? (end sarcasm)

Whenever you update your Gemfile, you do

bundle –binstubs

Bookmark this post : These icons link to social bookmarking sites where readers can share and discover new web pages.
  • DZone
  • Reddit
  • Digg
  • Furl
  • Technorati
  • StumbleUpon

8 thoughts on “Run bundle install with the –binstubs option

  1. jumski says:

    if you use rvm, you can use rubygems-bundler ( and you do not event need ./bin you can use your commands like always and rvm will prepend your bitstups to $PATH :)


  2. Frank says:

    Thanks for the comment Jumski! Yes I know about rubygems-bundler. It is an interesting solution but a bit too “magical” for me. My point is that I like having to explicitly type “./bin/” to run the binaries because it makes it crystal clear as to where these binaries are located.

  3. Jacques says:

    You can make it crystal clear where the binaries are located by doing “which binary”

  4. trans says:

    One could add ./bin to $PATH too, for a bit more ease of use.

    For a regular gem this could be a bit annoying if one’s project had it’s own bin files. For instance one would have to be careful they don’t all get included in the project’s gemspec.

    Could they be stubbed to script/ directory instead?

  5. Of key importance in helping to shape the Programme of Action were the recommendations made at five regional population conferences (for Asia and the Pacific, Africa, Europe and North America, Latin America and the Caribbean, and the Arab States) in 1992 and 1993, and a number of subregional preparatory meetings; expert group meetings on six issues identified by ECOSOC as requiring the greatest attention; and a series of ad hoc round tables on other important Conference themes. Important input also came from the second meeting of the Preparatory Committee, from discussion in the UN General Assembly in 1993 and from national population reports prepared in more than 140 countries.

  6. Drake says:

    Thanks everyone for your comments, i really appreciate. Hugo, your comment made my day. Knowing that some people appreciate

    my work means a lot to me. It’s cool to see your interest in the language. Ruby is one wild beast but to me it’s the most

    interesting and elegant language out there.

  7. Amir says:

    I’m very interested in this topic, as I am frtlueneqy put in a difficult place by projects I’m trying to use that have been abandoned, or the maintainers are just completely unresponsive for months at a time. I try to respond to any issues or pull requests open on my projects as soon as I can, usually within a day, but I don’t work on any open source that has a lot of users, so it’s not much pressure. I wonder how I would fare if I were trying to maintain something as popular as Bundler.I’d be interested in the hangout, if/when it happens.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>