Did you run through the script install of Discourse here?
Are you running macOS Catalina? If that’s the case, it sounds like you’re running into Discourse trying to use the system version of ruby. You’ll want to use something like rbenv to set your ruby version to avoid this.