ruby-build: Ruby installation fails in macOS Catalina
EDIT: Solution in comment below
I’ve seen the other issues #1408 #1394 #1395 but the error I’m experiencing is slightly different. This happens on any version of ruby I try to install.
$ rbenv install 2.7.0
Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...
BUILD FAILED (OS X 10.15.3 using ruby-build 20200224)
Inspect or clean up the working tree at /var/folders/s4/6_9qvyzn6kvcd2lz2jm3y_fw0000gq/T/ruby-build.20200303110227.33296.Nfnu5g
Results logged to /var/folders/s4/6_9qvyzn6kvcd2lz2jm3y_fw0000gq/T/ruby-build.20200303110227.33296.log
Last 10 log lines:
include/openssl/crypto.h:341:33: error: unknown type name 'time_t'; did you mean 'size_t'?
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
^~~~~~
size_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h:31:32: note: 'size_t' declared here
typedef __darwin_size_t size_t;
^
1 error generated.
make[1]: *** [apps/app_rand.o] Error 1
make: *** [all] Error 2
I’ve updated ruby-build and rbenv to the latest versions
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (3 by maintainers)
I had this same issue with a recent install of Catalina and worked around it by ensuring that
readlineandopensslwere both installed by homebrew and that my.zshrcwas configured to include those libraries in my compiler flags.First:
Then (via
.zshrc):Last:
For what it’s worth, the above solutions didn’t work to install Ruby 3.0 on macOS 11.1
edit : Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅
As I mentioned on the other issue try following:
It should work (not tested on Catalina).
Updating of the command tools helped me:
same problem on OSX Catalina 10.15.7
error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'@romicaiarca Hey man. What I ended up finding out is that 2.5.1 is not compatible with Big Sur or the M1 chip.
2.7.2+ is. I was able to download 2.7.2 and 3.0.0
see comments at: https://github.com/rbenv/ruby-build/issues/1705
Thank you @tobius, that worked perfectly
👏 bless you @pftg
That fix worked for me installing 2.7.5 on MacOS 12.0.1 Monterey after spending hours trying to reinstall ruby after messing up all my permissions/environment running
sudo gem install bundler.One thing to note is that my xcode-select version (2392) didn’t change so I guess the reinstall alone did the trick.
@DirtyF I went ahead and upgraded to macOS 11.1 and checked that xcode was at 2384. Any idea what else might be the issue? This is what is showed me:
erikschulte@Eriks-MacBook-Pro ~ % xcode-select -v xcode-select version 2384. erikschulte@Eriks-MacBook-Pro ~ % rbenv install 2.5.1 Downloading openssl-1.1.1i.tar.gz… -> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242 Installing openssl-1.1.1i… Installed openssl-1.1.1i to /Users/erikschulte/.rbenv/versions/2.5.1
Downloading ruby-2.5.1.tar.bz2… -> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2 Installing ruby-2.5.1…
WARNING: ruby-2.5.1 is nearing its end of life. It only receives critical security updates, no bug fixes.
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.1 using ruby-build 20201225)
Inspect or clean up the working tree at /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210112120819.73940.BmgW0u Results logged to /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210112120819.73940.log
Last 10 log lines: compiling …/…/./ext/psych/yaml/dumper.c compiling …/…/./ext/psych/yaml/reader.c compiling …/…/./ext/psych/yaml/emitter.c compiling …/…/./ext/psych/yaml/parser.c 5 warnings generated. linking shared-object date_core.bundle linking shared-object zlib.bundle 1 warning generated. linking shared-object psych.bundle make: *** [build-ext] Error 2
Huh, that’s weird. Why don’t you create a gist with your build log and post a link here?
I suspect you have stray headers in your
/usr/local/include. What doesbrew doctorsay? Search stack overflow and see if you can fix any complaints that it might throw and try again.