Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing ruby but getting error "linker command failed with exit code 1"

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

like image 612
dfried Avatar asked Sep 02 '25 06:09

dfried


1 Answers

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

like image 56
George S Avatar answered Sep 05 '25 00:09

George S