Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install ruby 3.0.0 on MacOS #5055

Closed
Dounx opened this issue Mar 6, 2021 · 14 comments
Closed

Can't install ruby 3.0.0 on MacOS #5055

Dounx opened this issue Mar 6, 2021 · 14 comments

Comments

@Dounx
Copy link

Dounx commented Mar 6, 2021

Description

Can't install ruby 3.0.0 on MacOS, but can install ruby 2.7.2.

Errors:

Installing Ruby from source to: /Users/dounx/.rvm/rubies/ruby-3.0.0, this may take a while depending on your cpu(s)...
ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection...
ruby-3.0.0 - #extracting ruby-3.0.0 to /Users/dounx/.rvm/src/ruby-3.0.0 - please wait
ruby-3.0.0 - #configuring - please wait
Error running ' CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib ./configure --prefix=/Users/dounx/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared',
please read /Users/dounx/.rvm/log/1615019173_ruby-3.0.0/configure.log
There has been an error while running configure. Halting the installation.

Logs in /Users/dounx/.rvm/log/1615019173_ruby-3.0.0/configure.log:

__rvm_log_dotted:23: permission denied: 

Steps to reproduce

  1. rvm install 3.0.0

Expected behavior

Install ruby 3.0.0 normally.

Actual behavior

Debug mode:

Environment info

ruby-2.7.2:

  system:
    uname:        "Darwin bogon 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64"
    name:         "OSX"
    version:      "11.2"
    architecture: "x86_64"
    bash:         "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)"
    zsh:          "/bin/zsh => zsh 5.8 (x86_64-apple-darwin20.0)"
    remote_path:  "osx/11.2/x86_64"
    xcode:        "12.4"

  rvm:
    version:      "1.29.12 (latest)"
    updated:      "20 minutes 21 seconds ago"
    path:         "/Users/dounx/.rvm"
    autolibs:     "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  ruby:
    interpreter:  "ruby"
    version:      "2.7.2p137"
    date:         "2020-10-01"
    platform:     "x86_64-darwin20"
    patchlevel:   "2020-10-01 revision 5445e04352"
    full_version: "ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]"

  homes:
    gem:          "/Users/dounx/.rvm/gems/ruby-2.7.2"
    ruby:         "/Users/dounx/.rvm/rubies/ruby-2.7.2"

  binaries:
    ruby:         "/Users/dounx/.rvm/rubies/ruby-2.7.2/bin/ruby"
    irb:          "/Users/dounx/.rvm/rubies/ruby-2.7.2/bin/irb"
    gem:          "/Users/dounx/.rvm/rubies/ruby-2.7.2/bin/gem"
    rake:         "/Users/dounx/.rvm/rubies/ruby-2.7.2/bin/rake"

  environment:
    PATH:         "/Users/dounx/.rvm/gems/ruby-2.7.2/bin:/Users/dounx/.rvm/gems/ruby-2.7.2@global/bin:/Users/dounx/.rvm/rubies/ruby-2.7.2/bin:/Users/dounx/.rvm/bin:/usr/local/opt/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS"
    GEM_HOME:     "/Users/dounx/.rvm/gems/ruby-2.7.2"
    GEM_PATH:     "/Users/dounx/.rvm/gems/ruby-2.7.2:/Users/dounx/.rvm/gems/ruby-2.7.2@global"
    MY_RUBY_HOME: "/Users/dounx/.rvm/rubies/ruby-2.7.2"
    IRBRC:        "/Users/dounx/.rvm/rubies/ruby-2.7.2/.irbrc"
    RUBYOPT:      ""
    gemset:       ""
@LouisStAmour
Copy link

At first I had the following error:

Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
translating probes probes.d
compiling ast.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling compile.c
compiling complex.c
compiling cont.c
compiling debug.c
. ./vm_opts.h
compiling debug_counter.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
compiling enum.c
compiling enumerator.c
compiling error.c
compiling eval.c
compiling file.c
file.c:39:11: fatal error: 'CoreFoundation/CFString.h' file not found
# include <CoreFoundation/CFString.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling gc.c
compiling hash.c
1 error generated.
make: *** [file.o] Error 1
make: *** Waiting for unfinished jobs....
++ /scripts/functions/support : __rvm_make()  383 > return 2

I tried to fix that by running export MACOSX_DEPLOYMENT_TARGET=10.14 as suggested at https://superuser.com/questions/1488979/macos-catalina-cannot-find-usr-include-file

Then I had the following error:

compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
translating probes probes.d
compiling ast.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling compile.c
compiling complex.c
compiling cont.c
compiling debug.c
. ./vm_opts.h
compiling debug_counter.c
compiling dir.c
compiling dln_find.c
In file included from debug.c:27:
./vm_callinfo.h:176:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
        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)
                                                                       ^
In file included from debug.c:27:
./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: *** [debug.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from compile.c:39:
./vm_callinfo.h:176:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
        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)
                                                                       ^
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
++ /scripts/functions/support : __rvm_make()  383 > return 2

So not sure how to fix this. :)

As a temporary workaround, running rbenv install 3.0.0 after installing https://github.com/rbenv/rbenv appears to work but takes forever.

A faster workaround is that you can install Ruby from Homebrew (brew install ruby) which ships as a binary but installs inside Homebrew with no option to replace the default system ruby.

You can use homebrew Ruby with RVM:

brew install ruby
rvm mount /usr/local/Cellar/ruby/3.0.0_1
rvm use ext-ruby-3.0.0-p0

@Dounx
Copy link
Author

Dounx commented Mar 14, 2021

brew install ruby
rvm mount /usr/local/Cellar/ruby/3.0.0_1
rvm use ext-ruby-3.0.0-p0

I am using this method to work :P

I tried to compile ruby-3.0.0 manually, no error. It's strange.

@Dounx
Copy link
Author

Dounx commented Apr 7, 2021

Ok, I found a solution, just run: rvm install 3.0.0 --with-gcc=clang

@rahul-onekingslane
Copy link

Ok, I found a solution, just run: rvm install 3.0.0 --with-gcc=clang

@Dounx - I tried the same command on Mac machine - not working. any suggestion

@Dounx
Copy link
Author

Dounx commented Jun 30, 2021

@rahul-onekingslane - Do you have any log?

@rebase-master
Copy link

I had similar issues. I tried all the possible steps to fix the compilation issues but it was not until I updated xcode on MacOS Big Sur that it succeeded.

@mayur-kambariya
Copy link

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
  2. Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Restart terminal
  3. Check Homebrew is working fine: brew doctor
  4. Reinstall openssl: brew install openssl
  5. Install Ruby: rvm install 2.7 Or any version

@ziaulrehman40
Copy link

--with-gcc=clang doesn't work, same error of RUBY_FUNCTION_NAME_STRING

@maryamfayyaz-qbatch
Copy link

@ziaulrehman40 Were you able to figure out some workaround?

@ziaulrehman40
Copy link

@maryamfayyaz-qbatch Yes, what worked for me was upgrading my mac(latest available release was 12.x, i was on 11.x) and re-installation of xcode + devtools.
I tried number fo other things, didn't work.
This obviously took some time(upgrade of mac was ~12GB, xcode was also ~10GB) but fixed the issue

@prabu-fluence
Copy link

It worked for me after installing devtools.

@caroparo
Copy link

Running "brew doctor" and updating xcode devtools following its instructions worked for me.

@brohit-97
Copy link

export warnflags=-Wno-error=implicit-function-declaration
export optflags="-w"
rvm install "ruby-2.6.3" --with-out-ext=fiddle
Resolved same issue with the above commands

@ImSingee
Copy link

This works fine

rvm install xxx --with-openssl-dir=`brew --prefix openssl`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests