Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs

Dashboard
Notifications
Mark all as read
Q&A

Installing Ruby on MacOS 11.6 produces compilation errors in the downloaded source; how do I fix?

+4
−0

A project I want to work on requires Ruby. I was directed to RVM or rbenv. I tried rbenv first because it has Mac instructions, ran into failures, uninstalled it and installed RVM, and still ran into problems. I am not sure how to debug. Details:

I am on MacOS 11.6 (Big Sur). I am using the terminal (bash command line). I'll jump to the problem with RVM because the developer I'm working with uses it.

I installed RVM using the following command (from their documentation):

\curl -sSL https://get.rvm.io | bash -s stable

That did not produce any error messages. This installation modified my .bash_profile, so I fired up a new shell. In it I used rvm list known and confirmed that the list includes [ruby-]2.6[.6], the version my project needs. I then typed:

rvm install "ruby-2.6.6"

Which produced a compilation error (substituting USER for my actual user name in paths):

Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/USER/.rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.4M  100 13.4M    0     0  7961k      0  0:00:01  0:00:01 --:--:-- 7957k
ruby-2.6.6 - #extracting ruby-2.6.6 to /Users/USER/.rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring......................................................|
ruby-2.6.6 - #post-configuration.
ruby-2.6.6 - #compiling...................................................
Error running '__rvm_make -j8',
please read /Users/USER/.rvm/log/1637706281_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.

I consulted the log file given at the end, where I found this error:

compiling date_core.c
compiling digest.c
readline.c:1905:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                    rl_username_completion_function);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    rl_username_completion_function
readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
                                     ^
/usr/local/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
             ^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2

My attempt to install using rbenv ended with a very similar error, so switching from RVM to rbenv won't solve my problem.

How can I remedy this problem? I'm wondering if these Ruby managers require something in my environment that I'm missing, despite the output saying that dependencies were checked. Maybe it's assuming a different compiler than whatever I have?

This error isn't coming from my code; it's coming from the Ruby source code that RVM downloaded and tried to build. I guess I could try debugging that code, if I knew anything about it, but that seems like the wrong approach. I'm trying to get the "official" Ruby 2.6.6 to run, not my locally-hacked Ruby 2.6.6.

I don't know Ruby or its environment; I'm hoping to learn as I work on this project. Because of that lack of experience, though, I don't know where to look next or how to debug this problem. How do I successfully install this version of Ruby?

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

3 comment threads

Check readline version and version requirements (3 comments)
MacOS is on-topic (4 comments)
A related bug report (2 comments)

1 answer

+0
−0

Wait a minute I think you missed something, yesterday when I read your message in Discord I thought you were unable to install RVM which were producing that error. But this question clears my confusion. You were executing rvm install "ruby-2.6.6" but that's not what we used to do.

I had written the same answer in another question of "mine". here it is (I had mentioned it in Discord either) (I don't have any idea if it's really good to link my old answer which account I had deleted, if it's bad purpose then you can edit or suggest edit). You should have execute

rvm install 2.6.6    #this will install 2.6.6 version of Ruby
rvm use 2.6.6        #you must execute it otherwise you will keep using earlier version (whichever you had in your system)

Sometimes, they don't work without being super user. So I used to use sudo but it sometimes doesn't work also. For that reason you should execute

/bin/bash --login       #I don't have idea, if the command really works in Mac

/bin/bash --login is nearly related to su -.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Didn't work. (3 comments)

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate