简体   繁体   中英

How to fix error when installing Ruby using RVM?

My OS is macOS Catalina 10.15.7 and I currently have ruby 2.6.3 installed.

I tried installing Ruby using RVM but it gives an error.

▶ rvm use ruby --install --default 
> Required ruby-3.0.0 is not installed 
> installing. ruby-3.0.0 - #removing src/ruby-3.0.0 - please
> wait Searching for binary rubies, this might take some time. No binary
> rubies available for: osx/10.15/x86_64/ruby-3.0.0. Continuing with
> compilation. Please read 'rvm help mount' to get more information on
> binary rubies. 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/soonersoft/.rvm/rubies/ruby-3.0.0, this may take a while
> depending on your cpu(s)... ruby-3.0.0 - #downloading ruby-3.0.0, this
> may take a while depending on your connection... ruby-3.0.0 -
> #extracting ruby-3.0.0 to /Users/soonersoft/.rvm/src/ruby-3.0.0 - please wait ruby-3.0.0 - #configuring - please wait Error running 'env
> CFLAGS=-O3 -I/usr/local/opt/libyaml/include
> -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib
> -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib ./configure --prefix=/Users/soonersoft/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared', please read /Users/soonersoft/.rvm/log/1612806268_ruby-3.0.0/configure.log There
> has been an error while running configure. Halting the installation.
> Gemset '' does not exist, 'rvm ruby-3.0.0 do rvm gemset create '
> first, or append '--create'.

Has anyone came across this same error? If so, how did you fix this?

Common steps to follow are the ones below:

ruby -v                         # To Check the current ruby version (if installed)
rvm install ruby-X.X.X          # To Install a specific ruby version
rvm list                        # To List the existing ruby versions                                    
rvm use ruby-X.X.X              # To Choose a version to use from the list ☝︎
rvm use ruby-X.X.X --default    # To Set a version as default

And, as @Tarek N. Elsamni mentioned:

rvm use ruby --install --default --create   # To create default gemset for Rails (visible in the last line of your error message)

You can always run the rvm list before and after the installation, as it gives you a better overview of all of the ruby version you've installed.

↳ Output example:

DRG@GALVEZWEB current_project % rvm list     

       ruby-2.6.6 [ x86_64 ]
       ruby-2.7.1 [ x86_64 ]
    =* ruby-3.0.0 [ x86_64 ]

    # => - current
    # =* - current && default
    #  * - default

You need to add --create flag to your command. To be:

rvm use ruby --install --default --create

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM