Skip to content

Instantly share code, notes, and snippets.

@yatsu
Last active July 13, 2023 19:36
Show Gist options
  • Save yatsu/b62f07ef9ff3ae1e0e2bf9a00b8742b6 to your computer and use it in GitHub Desktop.
Save yatsu/b62f07ef9ff3ae1e0e2bf9a00b8742b6 to your computer and use it in GitHub Desktop.
Install ruby-1.8.7 with rbenv on macOS Catalina (10.15)
#!/bin/sh
# 1) Install Xcode 11
# 2) Install command line tools: `xcode-select --install`
# 3) Install HomeBrew
# 4) brew tap cartr/qt4 && brew install cartr/qt4/openssl@1.0 subversion rbenv
# 5) Setup rbenv
# 6) Run this command
PKG_CONFIG_PATH="$(brew --prefix cartr/qt4/openssl@1.0)/lib/pkgconfig" \
CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls -I$(brew --prefix cartr/qt4/openssl@1.0)/include" \
LDFLAGS="-L$(brew --prefix cartr/qt4/openssl@1.0)/lib" \
rbenv install 1.8.7-p375
# If your macOS is older than 10.15, see the history of this gist.
@nerdo
Copy link

nerdo commented Oct 25, 2017

Thank you for making this public! :) 👍

@sj26
Copy link

sj26 commented Oct 30, 2017

This is so great, thank you 🙇‍♂️

@jpletner
Copy link

Thank you!! 👏 🏆 🌟

@calleo
Copy link

calleo commented May 12, 2018

Fantastic!

@hlopez
Copy link

hlopez commented May 16, 2018

Thanks for share! I have tried the script and I got this error:

BUILD FAILED (OS X 10.13.4 using ruby-build 20180424)

Undefined symbols for architecture x86_64: "___builtin_flt_rounds", referenced from: _Init_Numeric in libruby-static.a(numeric.o) _ruby_strtod in libruby-static.a(util.o) ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status

Did you have the same problem?, I will apreciate any additional help or recomendation.

Thank you in advance.

@provoke
Copy link

provoke commented May 31, 2018

wow, can I buy you a beer? big time saver!

@punitcse
Copy link

Thanks :)

@qd3v
Copy link

qd3v commented Aug 31, 2018

You're the best, dude! Thanks a lot!

@marcjeanson
Copy link

Thanks for posting this! It helped me install Ruby 1.8.7 with asdf-vm. I posted my gist if it's helpful.

@hypothetical
Copy link

Thank you so much for posting this, it has saved my life!!

@takano32
Copy link

takano32 commented Mar 4, 2019

Thanks!

@silentHoo
Copy link

Thank you for sharing this snippet 👍

If you use chruby you can also install the old ruby 1.8.7 with ruby-build with the commands provided by @yatsu:

CC=gcc-6 CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls -I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" ruby-build 1.8.7-p375 ~/.rubies/ruby-1.8.7

@rodrigoarino
Copy link

rodrigoarino commented Apr 5, 2020

Thank you 🙇
I used it to RVM and work fine

masOS Catalina 10.15.4 (19E266)

brew tap cartr/qt4 && brew install cartr/qt4/openssl@1.0
brew --prefix cartr/qt4/openssl@1.0 
>>> /usr/local/opt/openssl@1.0

rvm install 1.8.7-head --with-openssl-dir="/usr/local/opt/openssl@1.0"
 

@csage
Copy link

csage commented Sep 14, 2020

Thanks a lot for sharing this! Copied from rodrigoarino's comment and had the smoothest installation in a very long time. Highly appreciated!

@igavrysh
Copy link

I have this error when running on MacOC Catalina 10.15.4

eval.c:7288:2: error: implicit declaration of function 'rb_thread_join' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_thread_join(owner->thread, -1.0);
        ^
eval.c:7288:2: note: did you mean 'rb_thread_main'?
./intern.h:236:7: note: 'rb_thread_main' declared here
VALUE rb_thread_main _((void));
      ^

@yatsu
Copy link
Author

yatsu commented Jan 20, 2021

I have this error when running on MacOC Catalina 10.15.4

eval.c:7288:2: error: implicit declaration of function 'rb_thread_join' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_thread_join(owner->thread, -1.0);
        ^
eval.c:7288:2: note: did you mean 'rb_thread_main'?
./intern.h:236:7: note: 'rb_thread_main' declared here
VALUE rb_thread_main _((void));
      ^

Using gcc-6 or other versions may help.
See old version of this script in Revisions page.

(I don't have Catalina now.)

Copy link

ghost commented Apr 19, 2022

I have this error when running on MacOC Catalina 10.15.4

eval.c:7288:2: error: implicit declaration of function 'rb_thread_join' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_thread_join(owner->thread, -1.0);
        ^
eval.c:7288:2: note: did you mean 'rb_thread_main'?
./intern.h:236:7: note: 'rb_thread_main' declared here
VALUE rb_thread_main _((void));
      ^

Adding -Wno-error=implicit-function-declaration to CFLAGS has helped me (MacOS Monterey 12.3.1).

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