Setting up a new machine for Ruby development Sep 06 2011
33 comments Latest by Tony Huynh
It used to be a jarring experience to setup a new machine for development, but progress has paved the dirt road into a silky smooth autobahn. These are the tools we use today:
- Homebrew: Remember how painful it used to be to get imagemagick installed? Now it takes about a minute. “brew install imagemagick”. Same story for git and other Linux dependencies.
- rbenv/ruby-build: We have some apps running on Ruby 1.8.7, some on 1.9.2, and some on 1.9.3. ruby-build makes it easy to compile all three, rbenv makes it easy to switch between them on a per-project basis. We run rbenv in production as well, so all you need to do to change the Ruby version there is alter .rbenv-version—development and production is always on the same page.
- Bundler: Not everyone at 37signals loved Bundler at first, but now that it’s stable, they’ve been won over. I now curse whenever I have to use an old application that hasn’t been setup with Bundler. Manually tracing down dependencies?! How prehistoric!
rake setup: All our apps has a rake setup task that’ll run bundler, create the databases, import seeds, and install any auxiliary software (little these days) or do any other setup. So when you git clone a new app, you know that “rake setup” will take care of you.- Pow: No more messing with Apache or nginx for local development. All it takes for Pow to add another app is a symlink. All the apps are always configured and available at basecamp.dev, highrise.dev, etc without messing with the hosts file either.
Thanks to Max Howell for Homebrew, Sam Stephenson for rbenv/ruby-build and Pow, and Carl Lerche/Yehuda Katz for Bundler. Thanks to them, starting from scratch has never been easier.
Got a web design project in mind? Find a web designer on Sortfolio. Browse by visual style, portfolio, budget, and geographic location.
Over 1 million people use 37signals' simple web-based software to collaborate on projects, track contacts, and organize their business with an intranet.
33 comments so far
JP 06 Sep 11
Thanks for sharing DHH . But what do you like about rbenv over RVM ?
Dave C 06 Sep 11
Out of curiosity, why not rvm instead of rbenv?
Sam Soffes 06 Sep 11
I love the `rake setup` idea. Beats a really long complicated readme. Totally going to start doing that.
I’d love to hear why rbenv over rvm as well :)
Christopher G 06 Sep 11
I would like to hear about rbenv vs. RVM , as well. Wayne has put a ton of lifeblood into RVM , and I wonder why it falls short for you.
Vincent DS 06 Sep 11
I think Sam is an in-house developer who made it custom-tailored to 37s. So it’s probably well-suited for them :)
RVM is most likely overkill in their case.
DHH 06 Sep 11
Sam put together a good comparison of rbenv vs rvm on https://github.com/sstephenson/rbenv. I like the simplicity of rbenv, but it’s certainly an incremental benefit. The big deal is in using something to manage multiple ruby versions.
andy 06 Sep 11
does POW run on ubuntu / linux? if not – is there any POW like server for linux devs ??
Simon 06 Sep 11
Great share David, thanks!! imagemagick would give me cold sweats! Pow is an absolute dream, love it!
Jeremy Haile 06 Sep 11
Do you use SSL in development? If so, how do you get around pow’s lack of SSL support? For example, I run nginx as a reverse proxy in addition to pow so I can use SSL in development.
Also – you don’t mention any data stores…
Joris Verschoor 06 Sep 11
Basically, RVM changes the cd command. It IS easier to setup, but rbenv seems more natural
DHH 06 Sep 11
Andy, it does not. But everyone at 37signals run OS X . I’m not aware of a Linux port?
Jeremy, we do not use SSL in development. For data stores, we use mysql, redis, and memcached.
Vincent, there’s nothing 37s specific about rbenv, btw.
Jared 06 Sep 11
Pow is a useful tool and I would love to be able to use it, but there is a pesky file upload bug that is preventing that.
https://github.com/37signals/pow/issues/125
Any idea when this bug might get addressed? It seems there are many of us with the same issue.
Rasmus Bang Grouleff 06 Sep 11
Great list! I really like the idea about `rake setup` too and I’m definitely also going to use that from now on.
Thanks.
Casper 06 Sep 11
Amen, David. Another big thing about this, is that it enables newbs to get up and running quickly, without having to fiddle with stuff that’s not important, eg. if you’re trying to learn Rails, etc.
So yeah, huge thank you! to everyone that invests their time and resources in open source software!
Nathan Youngman 06 Sep 11
Thanks for sharing. We recently switched to Pow for development, and it’s certainly nice to be able to go to any subdomain without another hosts config.
JK 06 Sep 11
We’ve recently switched from the
rake setuptask to a standalonescript/setupshell script. The rake task required some nasty mucking with Rakefile and proved we should have kept setup at arm’s length from the app itself.An example
script/setup:Robert Evans 06 Sep 11
@DHH – Are you guys using foreman for background processes? I’d highly recommend it.
https://github.com/ddollar/foreman
JZ 06 Sep 11
@Casper – you’re exactly right. I’m a designer here and our new setup allowed me to get a new machine up and running without having to bug a programmer or sys admin. That’s a big win.
Richard Crowley 06 Sep 11
Blueprint is a much more thorough way to manage dependencies than Bundler-and-a-shell-script. It deals not only with RubyGems but with APT and Yum, so the entire dependency chain of your app can be automatically encapsulated in one place.
Daniel 06 Sep 11
The post above should have mentioned Linux, oops
Collin 06 Sep 11
I’ve gotta second Robert Evans on foreman.
Having a Procfile with app-specific commands for my databases and workers makes for a great “just works” experience when it comes to revisiting an old project.
Andrew 07 Sep 11
Just out of interest what h/w spec is your current best machine?
Jérémy Lecour 07 Sep 11
Hi,
You mention that you use rbenv in production. Is it with a “traditional” Apache + Passenger stack or with multiple proxies to multiple app servers like Unicorn (or else) ?
I’m curious about how to switch rubies in different apps.
Thanks.
JjP 07 Sep 11
Which OS X are you using? Snow Leopard (10.6.x) or already jumped on Lion (10.7.x)?
DHH 07 Sep 11
Jeremy, we use rbenv with nginx/unicorn in production using binstubs and ruby-local-exec. So the app starts from bin/unicorn which uses ruby-local-exec to get the right Ruby version from .rbenv-version.
Andrew, I use a 11” Air and a 27” iMac.
Andrew 07 Sep 11
@DHH: Awesome thanks. I’m assuming that no real development gets done on the small 11” screen? And is it fast enough?
Josh Goebel 07 Sep 11
I use an 11” Air everyday for “real” development… it’s all a matter of what you get used to… use a 11” primarily and 30” feels huge… use a 30” primarily and 11” feels tiny. That said, I do have a 27” Cinema, though I find I use it much less than I thought I would when I purchased it.
It’s quite possible to be productive on such a tiny setup. The first 11” Airs were a bit lagged, but the latest generation (I have the Core i7 upgrade) feels more than fast enough.
DHH 07 Sep 11
Andrew, I do lots if not most of my development on the 11”. It’s completely awesome and plenty fast enough for Rails work.
Andrew 07 Sep 11
@DHH Awesome – thanks for the replies :-)
Morten Møller Riis 08 Sep 11
Nice write-up David.
rbenv looks really nice. RVM can become a bit cumbersome in the long run (and different gemsets will start to take up space on your ssd)
Out of curiosity – does everyone run a local redis and memcached in development? And do you have a good way of seeding development databases with data from eg. production? I guess for designers this can be valuable?
Best regard.
Dmytrii Nagirniak 09 Sep 11
I am wondering how do you guys go about monitoring? Do you use Monit/Got/Bluepill? Or Forman export to Upstart?
Neither of those options look “beautiful” to me nor make me very happy :)
Jakub 09 Sep 11
Which OS X are you using? Snow Leopard (10.6.x) or already jumped on Lion (10.7.x)?
The reason I asked that is to find out if Lion is ready for Rails dev yet. I’m using Safari 5.1 on Snow Leopard and it’s the worst thing Apple did to me recently. 5.0 was the best. Stable, elegant Inspector. 5.1 crashes in a way that it refreshes tab by tab logging me out from my web apps. But I heard from some Lion user that Safari there is behaving normal.
As I’m not keen to upgrade my OS, but at the same time I cannot come back to Safari 5.0, I was wondering if you are already using Lion for Rails development.
Thanks.
Tony Huynh 09 Sep 11
Jakub,
All of the devs at my company are running Rails on Lion. Some of us upgraded from Snow Leopard while others got a new machine with Lion preinstalled.
Comments are closed