How to specify Ruby version on an OSX container?

I’m working on migrating my iOS project to CircleCI, but I’m running into an issue. The version of CocoaPods (0.39.0) that I’m using is not compatible with the Ruby version (2.3) installed on the OSX container. I have a .ruby-version file, but it’s not being used by the build container. I tried setting the Ruby version in the machine section of my config, like this:

    version: 8.0
    version: 2.1.8

…but the build errors with this message:

Setting the ruby version is not supported on OSX containers.

I’m starting to think that it’s not possible to specify a Ruby version, but maybe there is a different way.

How can I specify the correct Ruby version for my build? This is blocking me from purchasing a paid plan.