Error in downloading Ruby - any suggestions?

I’m running into a BUILD FAILED (OS X 10.15.2 using ruby-build 20191225). A couple lines down I get:

Last 10 log lines:
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions

Does anyone have any tips? I have fully updated my OS and have re-ran through Web Dev 101 more than once trying to figure out my error.

Much appreciated!

You could try brew install zlib first

Thanks for the reply -

I did brew install zlib, per the web dev 101 TOP page, however I am still getting this error towards the end:

Last 10 log lines:
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:

Can you confirm the output of the following in the terminal

which ruby
echo $PATH

What about cat ~/.zshrc

That gives me:

% cat ~/.zshrc
eval “$(rbenv init -)”

Can you confirm the output of brew install zlib

When I do that, I get this

Warning: zlib 1.2.11 is already installed and up-to-date
To reinstall 1.2.11, run brew reinstall zlib

Thanks for your help - I am just truly confused. I feel like I’ve gone through the steps on Web Dev 101 a dozen times, double checking my errors. Can’t for the life of me figure out how to get the updated ruby install

Which version of macOS do you have? iirc, sometimes issues like this one can be fixed by installing or updating Xcode Command Line Tools. It’s one of those things I’ll look to when I’m having issues bundling, especially with newer versions of macOS (Sierra+)

Try xcode-select --install first. If that doesn’t work, install the .dmg file specific to your macOS from here:

Thanks for the reply. I have OS Catalina 10.15.2 - to my understanding my computer is fully updated, and my Xcode version is fully updated as well (11.3.1). At least that’s the response I get when I look into any software updates on the app store, and through my terminal.

xcode-select: error: command line tools are already installed, use “Software Update” to install updates

I’ve also re-installed Xcode during this saga. I’m wondering if it’s a pathways issue? Like something is installed in the wrong folder - but again I really don’t know haha.

I know when I upgraded from Sierra to Catalina, I had to manually download the xcode code tools from Apple’s developer website: Installing/upgrading xcode-select command line tools the normal way from my terminal didn’t work for me and it gave me odd errors. It’s worth installing this manually.

Things you could try to rule out other possibilities:

  • Ensure xcode is installed manually through the Apple dev site; select the .dmg according to your os
  • brew doctor and fix what’s broken
  • If you’re using a ruby manager, like rvm or rbenv, reinstall them and follow their instructions to set your PATHS properly
  • As other’s have mentioned, brew install zlib might help; try uninstalling and reinstalling
  • Restarting the computer never hurt! Or at the very least, open a new terminal tab/window each time you install a new package

Appreciate the tip. At this point, I’m pretty sure I have gone through all of the above troubleshooting suggestions and am still running into the build error. I’m just going to post the full error one more time, to see if there is anything I am missing, but if you @pico or @CouchofTomato don’t see anything further I can do, I will just roll with my current version of Ruby. I’m hoping the learning objectives of TOP can still be achieved at the level I’m working at!

BUILD FAILED (OS X 10.15.2 using ruby-build 20200115)

Inspect or clean up the working tree at /var/folders/sp/bhfwfwn153v1q9llyftt2rbr0000gn/T/ruby-build.20200120102652.688.QqBN6s
Results logged to /var/folders/sp/bhfwfwn153v1q9llyftt2rbr0000gn/T/ruby-build.20200120102652.688.log

Last 10 log lines:
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:


I personally don’t use rbenv (rvm user here) to manage by ruby versions. But I just did a install of 2.6.5 using rbenv and couldn’t reproduce the errors you’re getting :frowning:

The following might help:

So can we try seeing what the following give you?

ls /usr/lib/libz*


ls /usr/local/lib/libz*

Then try deleting all files with libz* in the filename in /usr/local/lib/

Seems like others are having issues too in this forum, but no solution was given unfortunately…

Hey! Check it out :smiley: :

ruby 2.6.5p114 (2019-10-01 revision 67812)

It is fully downloaded and updated. Truth be told I was more frustrated about not understanding why I couldn’t download the software, and I still don’t fully understand, but it looks like ‘libz’ is at least partly to blame. I used

ls /usr/lib/libz*


ls /usr/local/lib/libz*

to get the list of all files with ‘libz’ then manually deleted those files as well as the preexisting ruby folder. Afterwards, rbenv install 2.6.5 worked just fine. I rebooted my terminal and now have the updated version of ruby. Should be good to go!

Thanks again @pico and @CouchofTomato for your time and help! Hope that this thread helps whoever else has to deal with this headache lol.

1 Like

I’m glad it all worked out in the end! Good job sticking with it!