It’s been two and a half years since my last laptop. It’s neat to look back and see how much has improved since then for setting up a Ruby development environment.
Of particular note, Homebrew, RVM, and Bundler did not exist back then.
Here’s how I set up an OS X 10.7 (Lion) thoughtbot laptop in 2011.
I need GCC to help install everything else so I downloaded GCC for Lion.
We used to have to install XCode to get GCC when OS X wasn’t for developers, which was a 3-4GB download and took 10GB+ of space. Buzzkill.
However, Kenneth Reitz, one of the Readability guys, fixed this with his OS X GCC installer, which is a comparatively svelte 272MB download.
Later on, when we’re installing things using Homebrew, we’ll see warnings like:
Xcode is not installed! Builds may fail!
But, the builds will build fine.
While that’s installing, we’ll customize our environment a little.
I need a public key to get access to private Github repositories.
ssh-keygen -t rsa
I’m kept hitting “enter” until it was done. Alternatively, I could have brought my old SSH key over but I’m not into falconry.
We have a standard set of configurations for vim, irb, git, zsh, and more.
I cloned the repo:
git clone git://github.com/thoughtbot/dotfiles.git
I ran the installer:
This sets up the appropriate symlinks (
~/.irbrc, etc.). I’ll stay up-to-date and contribute using the fork-track-update flow described in the README.
dotfiles assume zsh so I switched from the bash default to zsh:
chsh -s /bin/zsh
We’re pretty much all vim users here so it’s nice having super-quick home-row access to the
Control key… and who uses Caps Lock, anyway?
System Preferences > Keyboard > Modifier Keys
Already installed by default, but I set the global config:
git config --global user.name "Your Name" git config --global user.email email@example.com
I’m using Heroku for all my apps right now. However, thoughtbot’s clients and even our own apps like Trajectory are not owned by my Heroku account. So, it comes in handy to be able to switch to a different account on a project basis.
heroku plugins:install git://github.com/ddollar/heroku-accounts.git heroku accounts:add dan --auto heroku accounts:add thoughtbot --auto heroku accounts:add client --auto heroku accounts:default dan
Once GCC is downloaded and installed, I’m ready for the heavy-duty installation using our laptop script.
bash < <(curl -s https://raw.github.com/thoughtbot/laptop/master/mac)
It took about 15 minutes for everything to install.
While it’s running, it copies your SSH key to the clipboard and opens your Github SSH page. Paste your SSH key so your Github account is authenticated to your machine.
We wrote a laptop script because we help hundreds of people a year get a Ruby development environment set up at workshops and Boston Ruby hackfests. One time we set up 30 business school students’ laptops in 3 hours.
If you read our source, you’ll see it it’s very simple but more invasive than, say, the excellent Cinderella by Corey Donohoe, which uses Chef to keep your machine tidy. We’re assuming the person definitely wants a “thoughtbot laptop”.
It’s pretty easy to write a wrapper that installs Homebrew, RVM, and your favorite databases and gems so consider forking our project and writing your own script, just like you might write your own Rails template script like Suspenders.