2

I'm trying to install ruby 2.6.4 via rbenv on macOS Mojave

rbenv install 2.6.4

But every time I try it gives me:

ruby-build: using openssl from homebrew
Downloading ruby-2.6.4.tar.bz2...
-> 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.

Tried solutions so far:

1) xcode-select --install

2) Add missing packages in xcode open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

3) Reinstall rbenv and ruby-build via homebrew and direct

4) RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.6.4

sudo rbenv install 2.6.4 works but I want it to install without sudo because it leads to other complications when installing rails.

Does anyone know a solution to this issue?

Lahiru Jayaratne
  • 1,684
  • 4
  • 31
  • 35

1 Answers1

0

There is an issue about this problem. A solution from this comment:

I've resolved this issue by selecting Command Line Tools in Xcode > Preferences > Locations

Did you try this way?

demir
  • 4,591
  • 2
  • 22
  • 30
  • 3
    Yes, @demir. Still, it's not working. I even installed rvm instead rbenv, But the issue remains the same configure: error: C compiler cannot create executables – Lahiru Jayaratne Sep 23 '19 at 05:37