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
As I mentioned on the other issue try following:
$ brew install openssl
$ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
$ rbenv install 2.7.8
It should work (not tested on Catalina).
A different error but it still failed to install
Downloading ruby-2.7.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
Installing ruby-2.7.0...
ruby-build: using readline from homebrew
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.20200304140824.35624.zDAaZW
Results logged to /var/folders/s4/6_9qvyzn6kvcd2lz2jm3y_fw0000gq/T/ruby-build.20200304140824.35624.log
Last 10 log lines:
lzma_bool reserved_bool2;
^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool3;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
compiling gc.c
20 errors generated.
make: *** [file.o] Error 1
make: *** Waiting for unfinished jobs....
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 does brew doctor say? Search stack overflow and see if you can fix any complaints that it might throw and try again.
Also are your Xcode tools up to date? xcode-select --install
I had this same issue with a recent install of Catalina and worked around it by ensuring that readline and openssl were both installed by homebrew and that my .zshrc was configured to include those libraries in my compiler flags.
First:
[~] brew install readline openssl
Then (via .zshrc):
# Setup Compiler paths for readline and openssl
local READLINE_PATH=$(brew --prefix readline)
local OPENSSL_PATH=$(brew --prefix openssl)
export LDFLAGS="-L$READLINE_PATH/lib -L$OPENSSL_PATH/lib"
export CPPFLAGS="-I$READLINE_PATH/include -I$OPENSSL_PATH/include"
export PKG_CONFIG_PATH="$READLINE_PATH/lib/pkgconfig:$OPENSSL_PATH/lib/pkgconfig"
# Use the OpenSSL from Homebrew instead of ruby-build
# Note: the Homebrew version gets updated, the ruby-build version doesn't
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$OPENSSL_PATH"
# Place [email protected] at the beginning of your PATH (preempt system libs)
export PATH=$OPENSSL_PATH/bin:$PATH
# Load rbenv
eval "$(rbenv init -)"
# Extract the latest version of Ruby so you can do this:
# rbenv install $LATEST_RUBY_VERSION
export LATEST_RUBY_VERSION=$(rbenv install -l | grep -v - | tail -1)
Last:
[~] source .zshrc
[~] rbenv install $LATEST_RUBY_VERSION
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
ruby-build: using readline from homebrew
Installed ruby-2.7.1 to /Users/tobius/.rbenv/versions/2.7.1
Thank you @tobius, that worked perfectly
As I mentioned on the other issue try following:
$ brew install openssl $ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" $ rbenv install 2.7.8It should work (not tested on Catalina).
works for Catalina 10.15.5 using bash
@tobius is ruby-build supposed to announce that it is using home-brew readline? I can't get mine to print that regardless of the method used.
For what it's worth, the above solutions didn't work to install Ruby 3.0 on macOS 11.1
ProductName: macOS
ProductVersion: 11.1
BuildVersion: 20C69
rbenv install 3.0.0
Downloading ruby-3.0.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz
Installing ruby-3.0.0...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.0.1 using ruby-build 20201225)
Inspect or clean up the working tree at /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.2gn6ht
Results logged to /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.log
Last 10 log lines:
In file included from compile.c:39:
./vm_callinfo.h:217:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
if (debug) rp(ci);
^
./internal.h:95:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
^
2 errors generated.
make: *** [compile.o] Error 1
make: *** Waiting for unfinished jobs....
edit : Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅
rbenv install 3.0.0
Downloading ruby-3.0.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz
Installing ruby-3.0.0...
ruby-build: using readline from homebrew
Installed ruby-3.0.0 to /Users/frank/.rbenv/versions/3.0.0
Updating of the command tools helped me:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
For what it's worth the above solutions didn't work to install Ruby 3.0 on macOS 11.01
rbenv install 3.0.0 Downloading ruby-3.0.0.tar.gz... -> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz Installing ruby-3.0.0... ruby-build: using readline from homebrew BUILD FAILED (macOS 11.0.1 using ruby-build 20201225) Inspect or clean up the working tree at /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.2gn6ht Results logged to /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.log Last 10 log lines: In file included from compile.c:39: ./vm_callinfo.h:217:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING' if (debug) rp(ci); ^ ./internal.h:95:72: note: expanded from macro 'rp' #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^ 2 errors generated. make: *** [compile.o] Error 1 make: *** Waiting for unfinished jobs....
same problem on OSX Catalina 10.15.7
error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
@DirtyF
I have my macbook running 11.0.1
I was trying to following what you were doing to resolve your issue and was not sure what to do. Could you help? I am trying to get ruby 2.5.1 downloaded to do course work. I confirmed that Homebrew is installed, ruby-build is installed and so is rbenv. My issue is similar to yours. I am getting a failure:
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.0.1 using ruby-build 20201225)
Inspect or clean up the working tree at /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210110201435.35535.fAL4k0
Results logged to /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210110201435.35535.log
Last 10 log lines:
3 warnings generated.
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
Do you know what I need to do? I have no clue how to change to " Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅"
@emschult
xcode-select -v to check what version you're running (mine is currently 2384 on macOS 11.1).@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
@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.1Downloading 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.logLast 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
I have the same issue. If you find anything please post here.
@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
Ok, thanks! It looks like this is not a solution for me. I need to install ruby 1.9.3 because I'm using capistrano 2 on one of my project and the client don't approve updating it.
For what it's worth, the above solutions didn't work to install Ruby 3.0 on macOS 11.1
ProductName: macOS ProductVersion: 11.1 BuildVersion: 20C69 rbenv install 3.0.0 Downloading ruby-3.0.0.tar.gz... -> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz Installing ruby-3.0.0... ruby-build: using readline from homebrew BUILD FAILED (macOS 11.0.1 using ruby-build 20201225) Inspect or clean up the working tree at /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.2gn6ht Results logged to /var/folders/sh/jqmw4djd1f7_5c2qr92cn1sw0000gn/T/ruby-build.20201225183431.58053.log Last 10 log lines: In file included from compile.c:39: ./vm_callinfo.h:217:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING' if (debug) rp(ci); ^ ./internal.h:95:72: note: expanded from macro 'rp' #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^ 2 errors generated. make: *** [compile.o] Error 1 make: *** Waiting for unfinished jobs....edit : Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅
rbenv install 3.0.0 Downloading ruby-3.0.0.tar.gz... -> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz Installing ruby-3.0.0... ruby-build: using readline from homebrew Installed ruby-3.0.0 to /Users/frank/.rbenv/versions/3.0.0
You saved my day and my laptop(I was about to throw it across the room)
Most helpful comment
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: