3

I'm building a GitHub Pages site and trying to install Ruby for my Mac as described here. When I run ruby-install ruby , I get the following:

linking shared-object -test-/arith_seq/extract.bundle
Undefined symbols for architecture arm64:
  "_rb_arithmetic_sequence_extract", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_new_capa", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_ary_store", referenced from:
      _arith_seq_s_extract in extract.o
  "_rb_define_singleton_method", referenced from:
      _Init_extract in extract.o
  "_rb_path2class", referenced from:
      _Init_extract in extract.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../../../.ext/arm64-darwin22/-test-/arith_seq/extract.bundle] Error 1
make[1]: *** [ext/-test-/arith_seq/extract/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 3.1.2 failed!

I'm totally unfamiliar with Ruby and don't know how to make any sense of this. Any ideas? Thanks

dfried
  • 313
  • 2
  • 8
  • Are you using a M1 MacBook? – Chase McDougall Nov 08 '22 at 00:09
  • 1
    Seems to be an issue related to Xcode on Apple Silicon (M1/M2). I have no solution (yet). I have googled Undefined symbols for architecture arm64: "_rb_arithmetic_sequence_extract", see https://www.rubyonmac.dev/how-to-install-ruby-on-macos-12-6-apple-silicon – Christian Nov 08 '22 at 01:31
  • I'm using Apple Silicon and ended up going with one of the options mentioned in that rubyonmac explainer and downgraded to ruby 2.7.6 (I'm using rbenv for this) and then followed these additional instructions - https://stackoverflow.com/a/73251089/3050248 – Philip Ashlock Nov 08 '22 at 08:35
  • @PhilipAshlock but if you're using `rbenv` for managing Ruby versions (as you mentioned in the comment) why did you follow the instructions for `chruby`? – Konstantin Strukov Nov 09 '22 at 10:08
  • 2
    @Christian I have same issue as OP and your link worked for me. Specifically adding the enable-shared flag like so `ruby-install 3.1.2 -- --enable-shared` – George S Nov 15 '22 at 15:44

1 Answers1

8

I was running into same issue as you after following the Jekyll guide.

Christian from your comments supplied a very detailed solution and explanation as to what's caused it.

After updating to macOS 12.6 or 13.0, you might still be able to install 2.7.x and 3.x versions of Ruby with rbenv or asdf. With ruby-install, you’ll need to add the --enable-shared flag. Once 2.7.7 and 3.1.3 are released, you should no longer need to add any flags.

Install for me on Mac OS 12.6 worked with ruby-install 3.1.2 -- --enable-shared

George S
  • 315
  • 2
  • 10
  • You saved my day. Install for me on Mac OS 12.6 worked with ruby-install 3.0.4 -- --enable-shared – Saim Apr 19 '23 at 12:08