For a long time I had this problem where installing a Ruby through ruby-build or ruby-install would fail with an error saying "Undefined symbols for architecture x86_64".
linking static-library libruby-static.a
ar: `u' modifier ignored since `D' is the default (see `U')
verifying static-library libruby-static.a
ld: warning: ignoring file libruby-static.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
"_ruby_init", referenced from:
_main in main.o
"_ruby_init_stack", referenced from:
_main in main.o
"_ruby_options", referenced from:
_main in main.o
"_ruby_run_node", referenced from:
_main in main.o
"_ruby_sysinit", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libruby-static.a] Error 1
Today I finally found something on StackOverflow and someone suggested doing brew unlink binutils
.
I don't remember why I linked binutils in the first place, but I just installed Ruby 2.1.7 without any problems!