ruby-build: Can't install ruby on macOS High Sierra

I migrated my OSX from one MacBook to another and now I can’t install ruby. I tried to install different versions but no results. I tried to remove Command Tools and install it again.

I receive this error every time:

~ $ rbenv install 2.4.0
ruby-build: use openssl from homebrew
Downloading ruby-2.4.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.bz2
Installing ruby-2.4.0...1
ruby-build: use readline from homebrew

BUILD FAILED (OS X 10.13.2 using ruby-build 20171226)

Inspect or clean up the working tree at /var/folders/kk/5klq1cps5f3g1j5sxhrj4k080000gp/T/ruby-build.20180104142005.18508
Results logged to /var/folders/kk/5klq1cps5f3g1j5sxhrj4k080000gp/T/ruby-build.20180104142005.18508.log

Last 10 log lines:
/usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool2;
        ^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool3;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [file.o] Error 1
make: *** Waiting for unfinished jobs....

Detailed logs here: https://gist.github.com/blddmnd/0022c03bd2a551535ee06151a7102075

It will be great if someone can help me.

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 21
  • Comments: 17

Most upvoted comments

Solution is:

"I found a workaround by renaming /usr/local/include to /usr/local/include_old (well, name does not really matter, just the fact that g++/clang will not search for headers in this folder anymore). "

*g++/clang is looking for headers for some reason in this path, This happens when you migrate from one Mac to another and/or upgrade to HighSierra.

It did the trick and Finally, I was able to install Ruby!!!

Description: https://stackoverflow.com/questions/46872922/broken-c-std-libraries-on-macos-high-sierra-10-13

I had same problem. I deleted /usr/local/include/block.h from the result of brew doctor. Its works for me.

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  ~
  /usr/local/include/block.h

thanks @myxaluch

I have the same issue. I rename /usr/local/include to /usr/local/include to /usr/local/include to /usr/local/include_old and solve the issue. Thanks @stanislavpa

@blddmnd @kamusin I investigated with colleagues and we’ve found the solution. First, problem - it’s migration tool from old mac to new not correctly supports brew and libraries installed by brew. After migration, I’ve ran brew doctor and saw full log with .h files problems and broken symlink. After that, I began resolve each problem with library and dependencies, and when I clean my brew doctor output, I can install ruby successfully. So, maybe we could try it too

I can confirm that removing everything brew doctor complains about fixed the issue for me. 👯‍♂️ 👯

This worked for me as well. The migration tool is a disaster.

This thread saved my sanity. Thanks all for sharing trials and solutions.

Thanks all for the help here. /usr/local/include_old worked for me as well.

I get the same error as well. Used the migration tool from my old MBP to new MBP (MacBookPro14,2, OS - 10.13.3 (17D47)). I got the same error in the original post, then removed /usr/local/include/block.h and get the error below: (full log: https://gist.github.com/matthewsalan/07efbd850cb3cdf8bd0839ddbd4f7bed)

MacBook-Pro-7:~ alan$ rbenv install 2.3.1
ruby-build: use openssl from homebrew
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
ruby-build: use readline from homebrew

BUILD FAILED (OS X 10.13.3 using ruby-build 20171226)

Inspect or clean up the working tree at /var/folders/6t/14hdv24s1t56xl15hlhsb2z40000gn/T/ruby-build.20180127121027.24327
Results logged to /var/folders/6t/14hdv24s1t56xl15hlhsb2z40000gn/T/ruby-build.20180127121027.24327.log

Last 10 log lines:
process.c:7336:13: error: use of undeclared identifier 'uc'
            uc = (unsigned_clock_t)c;
            ^
process.c:7336:19: error: use of undeclared identifier 'unsigned_clock_t'
            uc = (unsigned_clock_t)c;
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
make: *** [process.o] Error 1
make: *** Waiting for unfinished jobs....
MacBook-Pro-7:~ alan$ subl /var/folders/6t/14hdv24s1t56xl15hlhsb2z40000gn/T/ruby-build.20180127121027.24327.log

@blddmnd Did reformatting the SSD and reinsalling OSX work for you?