Well, howdy there!
Have you been…
…interested in building web application, but aren’t sure where to start? We’ve all been beginners once, so let us lend a hand!
…seeking a technical co-founder, but finding it difficult? Investing the time to learn programming will do wonders. You’ll be better equipped to sniff out quality developers, and quite possibly knock out a prototype on your own.
…teaching yourself Ruby or self-studying on Rails and running into questions? Rubber Ducking can help, but it’s not nearly as much fun as meeting your fellow Boston Rubyists.
…programming Ruby or Rails for a little while (or a long while) and are looking to help teach and welcome new folks to the community?
Drop by the thoughtbot office this Tuesday, October 4, at 7pm. We’ll be hosting a structured session on getting your laptop set up for Ruby development. We’ll be following the process described here and be available for debugging:
2011 Rubyist’s guide to a Mac OS X development environment
Please RSVP to the event so we know how much food and how many drinks to get. We’re happy to field questions ahead of time in the comments below, or you can sign up for the Boston Ruby mailing list, mosey over to the email thread for this meetup, and say hello!
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:
./install.sh
This sets up the appropriate symlinks (~/.vimrc, ~/.irbrc, etc.). I’ll stay up-to-date and contribute using the fork-track-update flow described in the README.
Our 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 you@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)
This installs:
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.
An excellent little plugin, Visor is. You can have a Quake-style console that pops up whenever you want, in any app. Only trouble is that I wanted to be able to close Terminal.app and still have the Visor accessible. I found these directions linked off the Visor wiki to get rid of Terminal.app from the process list, which is a set in the right direction, but not perfect. There were some quirks that made the experience… iffy.
Here’s how to get Visor as it’s own, invisible, app, and still keep Terminal.app around like it always has been:
Ok! That takes care of that. It’s a bit more involved than the other instructions, but will completely separate Terminal and the Visor. Trouble is, they’re completely separate. You’ll have to set up the fonts and colors all over again, but it shouldn’t be that big a problem. If you have trouble getting the window settings to appear, open the Visor preferences from the Visor menu and the Window Settings should come right along. And the best part is that if everything worked correctly (you may need to log out and back in or reboot) the ANSI Colors option should still be in both Terminal’s and Visor’s settings.
I really, really can’t decide between TextMate and BBEdit, the majority of reasons of which I should leave for another post. But anyway, one of the most annoying things that I thought was left out of BBEdit was the ability to save the contents of the Documents Drawer for easy retrieval. I like to keep my work logically separated by window, and it’s a pain to drag all the documents I need where I want them every time.
Thanks to BBEdit being very Applescriptable, I wrote these scripts. Stick ‘em in your scripts folder and they’ll get some use.
Save Project
tell application "BBEdit"
set w to first text window
set theFiles to the file of every item ¬
of text documents of w
set f to choose file name with prompt ¬
"Select a project file."
try
set fSpec to open for access f ¬
with write permission
on error what
display alert ¬
"Could not save project." message what
close access f
return
end try
set eof of fSpec to 0
try
write theFiles to fSpec as list
on error what
close access f
display alert ¬
"Could not write project file." message what
return
end try
close access fSpec
end tell
Load Project
tell application "BBEdit"
set f to choose file
open for access f
set fs to read f as list
close access f
set w to make new text window
set show documents drawer of w to true
set doc to ID of first text document of w
set i to 1
open fs opening in w
close document id doc
end tell
It’s not gorgeous code, but it works. And it’s one less thing I have to worry about in BBEdit. Interestingly enough, I would have written these in Ruby with RubyOSA, but the darn thing won’t load BBEdit’s sdef because it uses non ASCII characters.
And for what it’s worth, I like to save the documents with a .bbdd extension.