title: BUILD FAILED (OS X 10.14.6 using ruby-build 20190828) Installing Ruby via rbenv
body: <p>I'm trying to install <code>ruby 2.6.4</code> via <code>rbenv</code> on <code>macOS Mojave</code></p>
  
  <p><code>rbenv install 2.6.4</code></p>
  
  <p>But every time I try it gives me:</p>
  
  <pre><code>ruby-build: using openssl from homebrew
  Downloading ruby-2.6.4.tar.bz2...
  -&gt; https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
  Installing ruby-2.6.4...
  ruby-build: using readline from homebrew
  
  BUILD FAILED (OS X 10.14.6 using ruby-build 20190828)
  
  Inspect or clean up the working tree at /var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278
  Results logged to /var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278.log
  
  Last 10 log lines:
  tool/config.guess already exists
  tool/config.sub already exists
  checking build system type... x86_64-apple-darwin18.7.0
  checking host system type... x86_64-apple-darwin18.7.0
  checking target system type... x86_64-apple-darwin18.7.0
  checking whether the C compiler works... no
  configure: error: in '/var/folders/tc/ctlyg05n4czbm9wb3vvm11xr0000gn/T/ruby-build.20190920102949.80278/ruby-2.6.4':
  configure: error: C compiler cannot create executables
  See 'config.log' for more details
  make: *** No targets specified and no makefile found.  Stop.
  </code></pre>
  
  <p>Tried solutions so far:</p>
  
  <p>1) <code>xcode-select --install</code></p>
  
  <p>2) Add missing packages in xcode
  <code>open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg</code></p>
  
  <p>3) Reinstall <code>rbenv</code> and <code>ruby-build</code> via <code>homebrew</code> and direct</p>
  
  <p>4) <code>RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.6.4</code></p>
  
  <p><code>sudo rbenv install 2.6.4</code> works but I want it to install without <code>sudo</code> because it leads to other complications when installing rails.</p>
  
  <p>Does anyone know a solution to this issue?</p>