Developing Mac Homebrew with RubyMine

I've been working with Mac Homebrew lately, and I prefer to work in an IDE for Ruby projects. You can set up JetBrains' RubyMine to work with Homebrew, but it can be a little tricky. Here, I'll explain how to do it in case anyone else is interested in working that way.

These instructions are written against RubyMine 2017.3.2 and Homebrew 1.5.3, but should work for other versions as well.

First, of course, install Homebrew and RubyMine.

Then, open RubyMine and create a new Empty project. You can call it whatever you want and store pretty much anywhere. I call mine Homebrew-local and save it in the default ~/RubymineProjects directory.

RubyMine New Project screen.png

Then you need to get Homebrew's code on to your project load path. Type ⌘-, to open Preferences, and select Project Structure from the list on the left. Click "+ Add Content Root" on the right side, and select /usr/local/Homebrew/Library/Homebrew in the file selection dialog that comes up. /usr/local is not visible in the file chooser by default, so you'll need to hit ⌘-⇧-G and type in /usr/local/Homebrew/Library/Homebrew to get there. Click on the newly added content root in the list on the right, and you should see a whole tree of files appear.

RubyMine Project Structure for Homebrew project.png

Then click on the "Load Path" tab at the top, click the "+" button at the bottom of the (empty) list, and again select /usr/local/Homebrew/Library/Homebrew in the file selector. That should take care of the paths.

Load paths.png

Next, you need to switch the project to use the "Portable Ruby" that Homebrew is running under, instead of the system Ruby. Click the triangle next to "Languages & Frameworks" in the list on the left, and click "Ruby SDK and Gems". In the list in the middle, click the "+" button and choose "New local...". Point it at /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/<version>/bin/ruby (again, use ⌘-⇧-G if needed) and select Open. The version will be something like "2.3.3", as of this writing. Then click the radio button next to the newly-added "ruby-2.3.X-pXXX" in the list. It should look something like this.

Ruby SDK selection.png

Note: You will need to repeat this Ruby SDK selection process each time Homebrew updates their Portable Ruby version!

That's it. RubyMine will now be able to follow around all the references in the core Homebrew codebase.

(I also like to turn off spell checking. It's in Preferences > Editor > Spelling, click "Configure 'Spelling' Inspection", uncheck "Typo".)

Happy hacking!

The Setup


The Setup 8/20/2017

I'm a freelance software developer, hobbyist photographer, and computer geek. That means I spend much of my day on the computer, and I spend a lot of time thinking about how to set it up well. This is what I've arrived at in 2017.

I use multiple computers, and have fully committed to that, contrary to al3x's Rules for Computing Happiness. I have a home desktop, an office desktop, and a few laptops. I've tried to set things up so I can get any of my work done on any of them, and they all feel as same as possible. So I rely heavily on cloud sync for my data, making that a shared, device-independent resource as much as possible. The exception is large media files: my photos and music live on my home desktop, and my movie & media collection lives on my NAS. Basically everything else is in a cloud drive or server-backed storage somewhere.

The Desk

Despite what you might think from the photo of my desk, my first concern with my workspace is ergonomics. I'm sitting at this desk many hours a week, so it's important that everything I touch and look at fit me well.

I'm 6'4" with long limbs, which informs my furniture choices.

My home desk is an IKEA Galant desk with adjustable-height legs (the heavy-duty single-pole legs with the bolt stop, not the picnic-table style continuously-adjustable ones). My chair is a Steelcase Leap. My home is lit with Cree LED bulbs in the summer, and GE incandescents in the winter. I have a basic IKEA thingy-holder rack bolted to the underside of the desk, and some headphone holders, but no real cable management in place. It's a rat's nest under there.

My office desk and chair are whatever WeWork provided. They're good enough, and the desk in particular is quite nice.

The Hardware

I prefer Apple hardware and macOS, so all my machines are Macs or iDevices. When I run Windows or Linux, it's in a VM or Boot Camp, or on a remote machine.

My home and office desktops are couple-year-old 27" iMacs, with maxed-out CPUs, RAM, and SSD. This was an easy choice; monitor quality is very important to me, and these are the best consumer displays I've ever seen, and the rest of the hardware is good too. And they Just Work.

I use mechanical keyboards. Currently using FILCO Majestouch Tenkeyless keyboards, with Cherry MX Brown switches at home, and the new Cherry MX "Silent Red" switches at the office. They are very nice. For mice, I'm still using a Microsoft Intellimouse 1.2A; I've never found anything that fits my hand better. Getting the PS/2-to-USB adapter to work in modern OSes keeps getting harder, but it hasn't stopped me yet. My mousepad is the sadly-discontinued Razer Kabuto "mobile" mousepad.

For laptops, I have:

  • 15" Mid 2012 MacBook Pro Retina
  • 15" Mid 2014 MacBook Pro Retina
  • 13" Late 2016 MacBook Pro (maxed out)

The Mid 2012 rMBP had been my favorite and main laptop up until recently, when I got the little 13" 2016 MBP. I'm still not sold on the new low-travel keyboard, but it's so nice in every other respect, and so portable, that the 13" 2016 has become my main laptop.

I keep one of these laptops as a "hot spare" in case one of my other machines breaks, and to use for testing restores of my backups.

All the laptops are maxed out for CPU/RAM/SSD. I usually buy maxed-out machines to prolong their life. The one time I didn't was earlier this year, when I bought a base model 13" MacBook, since it was just going to be a "travel and coffeeshop" machine. Mistake: I liked it so much I wanted to switch to it as my main development laptop, so had to get rid of it and get a maxed-out one.

I always buy the AppleCare.

I use a NAS at home. I have a Synology DS415+. I'm quite happy with it overall, but I wish I had ponied up for an 8-bay one. Which sounds ridiculous for a home network, but I've run in to cases where it would have been useful.

I use Tripp-Lite Isobars for surge protectors and power strips.

I avoid Belkin whenever I can.

The Data and Services

My personal photo library and music collection sit on the hard drive of my home desktop. All my other long-lived data is backed by a cloud service of some sort.

Pretty much all my data sits in Dropbox, and I have my full Dropbox synced to all my machines. I've been using Dropbox for years, and am happy with it.

I use:

  • Dropbox for general data storage
  • 1Password for passwords
  • FastMail for email hosting
  • Google Chrome login for syncing web bookmarks etc

The Backups

For backups, I follow the "3-2-1 Rule", and then some. I do:

  • Local Time Machine backups to multiple USB external drives, kept at my apartment
  • LAN Time Machine backups to a shared drive on my NAS
  • Cloud backups to Backblaze
  • Secondary cloud backups to Arq Backup

Plus almost all my data is in Dropbox.

I test restores every so often by doing a restore to my standby laptop. It's a pain, because that collides with notions of machine identity. I'm not satisfied with my backup testing situation.

The Software

I use a bunch of software on my machines. Much of it is installed manually. Command-line stuff is installed via Homebrew.

I use:

  • Thunderbird
  • f.lux
  • JustNotes
  • Bartender (for status bar management)
  • Moom (for window management)
  • iTerm2
  • Text Editors:
    • Sublime Text
    • BBEdit
    • vim
    • Atom
      • (I wrote this blog post in Atom; it has the best user-friendly Markdown handling.)
  • Browsers: All of Google Chrome, Firefox, Thunderbird, Opera, and TorBrowser
  • IDEs:
    • Matlab
    • NetBeans
    • All of JetBrains's IDEs, including RubyMine, IntelliJ, PyCharm, and DataGrip
    • R, RStudio
  • Atlassian SourceTree
  • VMware Fusion
  • Acorn
  • Aperture (sadly discontinued, so you can only get it if you already purchased it.)
  • Calibre (with my library stored in Dropbox)
  • Microsoft Office
  • ...and a bunch of other stuff...

And, of course, Homebrew. I install it, along with a bunch of "standard" packages I've decided on, and switch it in to "developer mode", since I'm maintainer.

For Thunderbird, I do a full local folder sync and have locally-stored keys and certificates. To get it running on a new machine, I bootstrap it by copying over the profile directory from one of my existing machines.

I also do a bunch of configuration for OS and application settings.

I keep my config files and setup scripts in a dotfiles repo on GitHub, which I clone to all my machines and use to set them up.

My software setup process is partially automated, and I'm working on getting it even more automated. Maybe I'll discuss that in a future post.

Setup on Windows is a whole 'nother story.

The Audio

I listen to music on big over-ear headphones driven by external headphone amps. Headphones are kind of my hobby, so at any time, I usually have a few headphones and headphone amps on my desk.

I can't tell the difference between any decent DACs, so I just have my headphones setup to use a single DAC (currently a Musical Fidelity V-DAC) feeding in to a cheap passive 8-way RCA switch I found on Amazon, which fans out to the various headphone amps I have going.

My favorite amps are the HeadRoom Ultra Desktop and Schiit Audio Valhalla 2; I doubt they'll ever lose their place on my desk. My permanent-rotation headphones are the Denon AH-D7000/Fostex TH900, Beyerdynamic DT-990 250 ohm, and Sony MDR-7506.

My main room speaker is an old Logitech Pure-Fi Elite, which is still my favorite iPod dock. (I had a Peachtree Deepblue2, but it was too loud and bassy for my Brooklyn apartment.) And I still use my old spinning-rust iPods as my main music player.

The Miscellaneous

Some other of my favorite things to keep on my desk:

A Gerber Paraframe folding knife.

Muji rollerball pens.

Trader Joe's coffee.