I’m trying to learn about the Ruby language’s source code, so I tried installing it from source. I figured this would be safe to do, since I’m using RBENV to manage my Ruby version and typing which ruby
results in /Users/richiethomas/.rbenv/shims/ruby
, so I figured that RBENV’s version of Ruby would still be first in my $PATH
and any faulty installation of Ruby from source would have no effect.
Following the instructions here, I pulled down the code from Github and ran ./autogen.sh
. I verified that the configure
file had been created by autogen.sh
, and then I ran ./configure
. The output of this script was:
Configuration summary for ruby version 3.4.0
* Installation prefix: /usr/local
* exec prefix: ${prefix}
* arch: arm64-darwin23
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: darwin23
* compiler: clang
* with thread: pthread
* with coroutine: arm64
* with shared GC: no
* enable shared libs: no
* dynamic library ext: bundle
* CFLAGS: -fdeclspec ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -fstack-protector-strong
* DLDFLAGS: -Wl,-undefined,dynamic_lookup
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wextra-tokens
-Wdeprecated-declarations -Wdivision-by-zero
-Wdiv-by-zero -Wimplicit-function-declaration
-Wimplicit-int -Wpointer-arith -Wshorten-64-to-32
-Wwrite-strings -Wold-style-definition
-Wmissing-noreturn -Wno-cast-function-type
-Wno-constant-logical-operand -Wno-long-long
-Wno-missing-field-initializers
-Wno-overlength-strings -Wno-parentheses-equality
-Wno-self-assign -Wno-tautological-compare
-Wno-unused-parameter -Wno-unused-value
-Wunused-variable -Wmisleading-indentation -Wundef
* strip command: strip -A -n
* install doc: rdoc
* YJIT support: no
* RJIT support: yes
* man page type: doc
---
Lastly, I verified that the Makefile
was created, and ran make
. I saw an error at the bottom of this output:
BASERUBY = ./tool/missing-baseruby.bat
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -arch arm64
XCFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE -I. -I.ext/include/arm64-darwin23 -I./include -I. -I./prism -I./enc/unicode/15.0.0
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-undefined,dynamic_lookup -fstack-protector-strong -Wl,-pie -framework CoreFoundation -arch arm64
SOLIBS = -ldl -lobjc -lpthread
LANG = en_US.UTF-8
LC_ALL =
LC_CTYPE =
MFLAGS =
RUSTC = no
YJIT_RUSTC_ARGS = --crate-name=yjit --crate-type=staticlib --edition=2021 -g -C lto=thin -C opt-level=3 -C overflow-checks=on '--out-dir=/Users/richiethomas/Desktop/Workspace/RubySource/ruby/yjit/target/release/' ./yjit/src/lib.rs
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
compiling ./main.c
compiling dmydln.c
generating id.h
executable host ruby is required. use --with-baseruby option.
Note that BASERUBY must be Ruby 3.0.0 or later.
make: *** [id.h] Error 1
Wanting to see if I could run Ruby, I typed irb
in my terminal, but saw the following:
$ irb
zsh: killed irb
Now wanting to undo what I had done, I tried running make clean
and saw the following:
$ make clean
cleaning rdoc
cleaning HTML
cleaning capi
However, when I re-ran irb
, I continued to see the same zsh: killed irb
error. I also tried running irb
in a Bash terminal, but saw a Killed: 9
error. I also see this error when I open a new terminal window, and also when I navigate to a new directory.
I’m currently unable to run Ruby on my machine, which is a big problem. Where did I go wrong here, and how do I fix the issue?