Homebrew must be run under Ruby 2.3! (RuntimeError)

How were you setting the machine version? Through the config like below?

machine:
  ruby:
    version: "2.3.1"

The 8.3.3 Xcode image has ruby 2.3.4 installed, so try updating it to version: "2.3.4". You can read more about what software versions are available in each of our OSX image docs here. If you’re using a Xcode image different from 8.3.3 you can check the docs to see what ruby version is available in your image.