RVM pkg install checksum error - ruby

root#li417-132:~# rvm pkg install zlib
Fetching zlib-1.2.7.tar.gz to /usr/local/rvm/archives
There is no checksum for 'http://prdownloads.sourceforge.net/libpng/zlib-1.2.7.tar.gz' or 'zlib-1.2.7.tar.gz', it's not possible to validate it.
If you wish to continue with unverified download add '--verify-downloads 1' after the command.
Please note that it's required to reinstall all installed rubies:
rvm reinstall all --force
rvm all-gemsets do rvm gemset pristine
A weird problem happened today, other linux boxes i've setup a few days ago never did this, but today i cannot install any rvm packages, and adding '--verify-downloads 1' after the command seems to have no effect at all.

this is a new change in RVM, you can make it work with:
rvm --verify-downloads 1 pkg install zlib
The best solution would be adding md5 / sha512 for zlib so it could be validated
The command parsing was fixed already, udate rvm to make it working:
rvm get head
Deprecation warning:
rvm pkg is deprecated by autolibs:
rvm get stable
rvm autolibs enable
rvm install ruby
RVM will automatically use system package manager to install missing libraries and configure ruby with proper compilation settings if needed - on OSX RVM detects macports, homebrew, fink and if non found installs macports to handle the libraries installation.

Related

Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

I'm attempting to install jekyll and I've encountered an error. I'm running Mac OS X 10.11.4 (El Capitan).
$gem install jekyll
ERROR : While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
$gem source -l
https://ruby.taobao.org
$which openssl
/usr/local/bin/openssl
I welcome your suggestions how to resolve this error.
Newer versions of OSX deprecated openSSL, leaving many dependencies broken. You need to reinstall ruby, but specify exactly where your openSSL libraries are. If you're using rvm then that looks like:
rvm reinstall 2.3.0 --with-openssl-dir=/usr/local/opt/openssl
If you're using homebrew, then a quick shortcut to where your libraries are is:
brew install openssl
rvm reinstall 2.3.0 --with-openssl-dir=`brew --prefix openssl`
Method 1 (Install OpenSSL)
Type all these commands in your Terminal (OSX) just to be extra sure you've done everything:
rvm get stable
brew update
brew doctor
brew install openssl
rvm install ruby-2.4 (or whatever version)
rvm use ruby-2.4 (or whatever version)
rvm gemset create jekyll
gem install jekyll
Finally, you need OpenSSL installed before you compile Ruby before you install Jekyll (or other gems)!
Method 2 (Reinstalling Ruby)
Newer versions of OSX deprecated openSSL.
You need to reinstall Ruby!
RVM with OpenSSL
rvm reinstall 2.3.0 --with-openssl-dir=/usr/local/opt/openssl
With the latest RVM version
rvm get stable
rvm reinstall ruby-2.3.0
homebrew and OpenSSL
brew install openssl
rvm reinstall 2.3.0 --with-openssl-dir=`brew --prefix openssl`
You just need to set this env variables so your compiler has the correct path for openssl libs (if using Homebrew on macOS, try brew info openssl to see this info):
$ export LDFLAGS=-L/usr/local/opt/openssl/lib
$ export CPPFLAGS=-I/usr/local/opt/openssl/include
# For pkg-config to find this software you may need to set:
$ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
Then reinstall your ruby (rvm reinstall ruby-version)
brew install openssl
brew info openssl # do the suggested options
$ export LDFLAGS=-L/usr/local/opt/openssl/lib
$ export CPPFLAGS=-I/usr/local/opt/openssl/include
# For pkg-config to find this software you may need to set:
$ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
rvm reinstall <version> --with-openssl-dir=`brew --prefix openssl`
For ubuntu 22.04. Ruby will not compile with openssl v3. Which is the openssl if you install it using brew.
Do this:
brew install openssl#1.1
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl#1.1`
To solve this issue, you should install OpenSSL version 1.1, and link ruby to it while installing process.
Here the commands worked fine with me (macOS):
// install openssl#1.1
brew install openssl#1.1
// export PKG_CONFIG_PATH variable
export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl#1.1/lib/pkgconfig
// reinstall your ruby version with openssl 1.1 dir
rvm reinstall 3.0.4 --with-openssl-dir=/opt/homebrew/opt/openssl#1.1
Considering the other answers related to openssl, we can see the same error yet when we try to execute as a superuser in some cases, as follows:
filipe#FILIPE:~$ sudo gem install bundler
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
Without superuser permissions, we can see a different behavior, a successful one, as follows:
filipe#FILIPE:~$ gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Installing ri documentation for bundler-1.14.6
Done installing documentation for bundler after 4 seconds
1 gem installed

Couldn't require openssl in ruby

I have openssl installed in my virtual machine ubuntu12.04lts.
When I run the gem command it gives error.
Error: while executing gem (Gem::Exception)
Unable to require openssl. install openSSL and rebuilt ruby (preferred) or use non HTTPs sources
And I also test require openssl in irb mode.
it gives error.
Loaderror: cannot load such file --openssl
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 `require'
I have openssl
$openssl version
OpenSSL 1.0.1 14 mar 2012
How to fix the error?
Note: Calls to rubygems.org are deprecated - proceed with caution!
I had the same issue on Mac OSX after also building ruby2.1.0p0 from the source. I already had openssl installed. It appears that the reference in gems needed refreshing. I ran:
gem source -r https://rubygems.org/ to remove
followed by
gem source -a https://rubygems.org/ to read
After this, I was able to run gems install bundler successfully.
If you run into further errors, you can try ./configure --with-openssl-dir=/usr/local/ssl in your ruby downloaded dir/.
I got this error while using debian where openssl was in /usr/bin.
Following the suggestion of jspacek I reconfigured ruby using:
./configure --with-openssl-dir=/usr/bin
After make and sudo make install I was able to install rails.
make sure you have libssl-dev installed:
dpkg -s libssl-dev
if not, install it:
sudo apt-get -y install libssl-dev
In case someone else has this problem, try reinstalling your Ruby version with openssl included
brew install openssl
rvm reinstall 2.4.0 --with-openssl-dir=`brew --prefix openssl`
You might already have openssl - so you can ignore the first step.
This helped me.
I'm leaving this answer for reference to future Googlers:
Type all these commands in your Terminal (OSX) just to be extra sure you've done everything (this is what eventually worked for me)
rvm get stable
brew update
brew doctor
brew install openssl
rvm install ruby-2.1 (or whatever version)
rvm use (ruby version here) i.e. rvm use ruby-2.1
rvm gemset create NAME i.e. rvm gemset create rails41
gem install rails -v 4.1
Finally...
As many commenters have pointed out - you need OpenSSL installed before you compile ruby before you install rails (or other gems)
You probably built Ruby from source before installing OpenSSL. Make sure you install it and then try reconfiguring and rebuilding Ruby.
Recently I was struggling with ruby installations due to the recent auto-update in openssl version from 1.0 to 1.1 and wanted to revert it back to older version. No other solution except the one given below worked for me:
brew install rbenv/tap/openssl#1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl#1.0'
gem update --system
Now my ruby runs with openssl 1.0 whereas all other libraries are running on the default openssl version 1.1.
Rebuilding Ruby after running sudo apt-get install libssl-dev libreadline-dev libgdbm-dev can solve this issue.
I found this solution here.
I was getting this error installing Ruby with RVM. Nothing worked. I switched to rbenv. Problem solved!
for me it was a case of missing dependencies.
i thought i had all the dependencies required to install ruby, but i too was getting an openSSL and readline error.
i attempted to install ruby with RVM without root privileges which failed but gave me a list of missing dependencies. i then installed the dependencies with a package manager. i then re-attempted to install ruby from source from the beginning, and everything worked OK
the dependencies that were missing, for me, were:
patch libyaml-devel autoconf gcc-c++
readline-devel libffi-devel openssl-devel
automake libtool bison sqlite-devel
but they may be different for you.
update: i don't originally remember where exactly i found this list, but a quick search found similar lists on the following pages, which might also help you:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-centos-6-with-rvm
http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/install-ruby-on-rails-on-centos-ubuntu-fedora-from-source.html
These steps worked for me:
Fixed ruby install:
brew upgrade openssl;
openssldir=which openssl
rvm reinstall ruby-2.4.2 --with-openssl-dir=$openssldir
Removed and re-added sources for gems
gem sources -r https://rubygems.org/
gem sources --add https://rubygems.org/
i had similar issue and tried to solve it by following guides. The "rebuild ruby" is an important step!
after openssl_devel is installed
cd folder_of_ruby_source_code/ext/openssl
ruby ./extconf.rb
make
make install
cd folder_of_ruby_source_code
./configure
make clean <= clean is important here
make
make install
Do you use RVM?
If not, try using it and see if it fixes your problem.

Unable to get ruby running on Mac OSX 10.8.3

I have been trying to get Ruby to run on my Mac for a few days and whatever I do does not seem to be successful. I have installed MacPorts and followed the post here: Installing Ruby on Mac OS X 10.8.2
I ran the following commands:
sudo port selfupdate
sudo port install apple-gcc42
They completed sucessfully then I ran the line below:
CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl
After I run that line it takes a couple minutes and I get the following:
enter code here MacPorts base is already the latest version
DEBUG: Setting MacPorts sources ownership to root
The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
i686-apple-darwin12-gcc-apple-4.2.1: no input files
Missing required packages: autoconf, automake, libtool, pkgconfig, libiconv, libyaml, readline, libxml2, libxslt, libksba, openssl, curl-ca-bundle, sqlite3, zlib, ncurses, gdbm.
Cowardly refusing to continue, please read 'rvm autolibs'.
There were package installation errors, make sure to read the log.
Do I need to install the missing packages that it references? If so, how do I do this? I'm not very familiar with MacPorts and would appreciate the help to get this working.
Since I originally I went to install RVM through https://rvm.io/rvm/install/ I followed the first command to RVM with ruby:
$ \curl -#L https://get.rvm.io | bash -s stable --autolibs=3 --ruby
After I ran the command it downloaded and compiled then when it went to install rubygems-2.0.3 for ruby-2.0.0-p0 it gave the following error message:
Error running 'env GEM_PATH=/usr/local/rvm/gems/ruby-2.0.0-p0:/usr/local/rvm/gems/ruby-2.0.0-p0#global:/usr/local/rvm/gems/ruby-2.0.0-p0:/usr/local/rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/usr/local/rvm/gems/ruby-2.0.0-p0 /usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /usr/local/rvm/src/rubygems-2.0.3/setup.rb --verbose',
please read /usr/local/rvm/log/ruby-2.0.0-p0/rubygems.install.log
I then went to open the log file and at the bottom it says
ERROR: While executing gem ... (NoMethodError) undefined method fu_stream_blksize for #<Gem::Commands::SetupCommand:0x007fa09b05d7a8>
Installing RubyGems
Installing gem executable
Any ideas what I can do next?
Thanks in advance.
I had similar problems with OS X 10.8.3 and XCode 4.6.1. After some googling, I tried the install with a similar RVM command, except using the XCode version of clang (which symlinks to /usr/bin/cc). Try this:
\curl -#L https://get.rvm.io | bash -s stable #just get rvm
source ~/.rvm/scripts/rvm
rvm get head # update to latest rvm
CC=/usr/bin/cc rvm install ruby
It should have the same failure installing rubygems-2.0.3, but reinstalling just rubygems should work:
CC=/usr/bin/cc rvm install rubygems latest # substitute "2.0.3" for "latest" if you like.
It appears that this is a bug in rubygems which is scheduled for fixing in 2.0.4.
Hope that helps!
I think this bug provide from FileUtils.
To fix it you need change rubygems script from rvm: nano .rvm/scripts/rubygems
To find words in nano use ctrl+w setup.rb and remove --verbose option.
After this you need ctrl+o to save file and ctrl+x to close nano.
Now you may reinstall rubygems:
rvm rubygems remove
rvm rubygems latest
Sorry for my bad english.
Hope this help you.
In addition to Valery's answer, you might have to do the following before removing and reinstalling:
echo ${LANG:-empty}
export LANG=en_US.utf-8
Links to the problem and solution:
https://github.com/rubygems/rubygems/issues/516
https://github.com/wayneeseguin/rvm/issues/1689
This problem is harmless, rubygems is already installed and will work as expected, this is triggered by https://bugs.ruby-lang.org/issues/7992 - with --verbose flag to rubygems installation - your ruby is fully usable if there was no other error during installation.
A side note, RVM detects all the options/flags you have passed and it is not required to pass them manually, it would be enough to run:
rvm install ruby-1.9.3-p194
The RVM installer ran with --autolibs=3 is equivalent to running it withoug and setting it manually with:
rvm autolibs 3
To get more information on autolibs and available modes run:
rvm help autolibs

Ruby and "You must recompile Ruby with OpenSSL support or change the sources in your Gemfile"

Using rvm I upgraded my ruby to 1.9.3-p392, also added 2.0.0, anytime I try to use this version when I run my bundle command I get this error.
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using RVM are
available at rvm.io/packages/openssl.
I have followed several different instructions on how to fix this. I have tried removing the version and installing it with the rvm options
--with-openssl-dir=$HOME/.rvm/usr
I have installed OpenSSL with rvm, and macports. Both have not helped the problem. I even changed the file location of the ssl cert using this:
export SSL_CERT_FILE=/Users/DarkLord/.rvm/usr/ssl/cert.pem
No matter what I do I continue to get the error.
Can someone please help me fix this?
This works for me:
rvm get stable
brew install libyaml
rvm pkg install openssl
rvm install ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
rvm use ruby-2.0.0
All credits go to https://coderwall.com/p/tptocq
This helps me install 1.9.3-head on Mac:
rvm get latest
brew install openssl
rvm reinstall 1.9.3-head --with-openssl-dir=`brew --prefix openssl`
In my case after:
1. brew install openssl
2. rvm install ruby-2.6.0
bundle install failed with this error. The problem was that openssl was globally set so I had to install the new ruby version by setting the openssl directory explicitly.
So what I had to do was:
1. rvm reinstall ruby-2.6.0 --with-openssl-dir=/usr/local/opt/openssl
2. rvm reload
Assuming that usr/local/opt/openssl is where it is installed.
After that bundle install ran successfully.
Warning when I tried this command with this path /usr/local like some answers suggested, it didn't work.
To get this working again I had to install homebrew and move my mac ports out of the way. Then do the following after removing 1.9.3-p392 and 2.0.0-p0:
rvm get head --autolibs=3
rvm install 1.9.3 --with-opt-dir=/usr/bin
rvm install 2.0.0
There was something not working with my mac ports and openssl and make and configure. This was the only way I was able to get rvm to install ruby again with out getting openssl issues or make/configure issues.
The new way to do it, according to a comment by #Purplejacket above, is the following:
rvm autolibs homebrew
rvm install 2.1.1
rvm use 2.1.1
It's much easier.
In my case:
Problem: After installing ruby-2.3.1, I ran the command bundle install and then the error occurred.
Solution:
I first installed OpenSSL on my machine. $ brew install openssl
And then, reinstalled the ruby version I require (2.3.1) with the openssl.
$ rvm reinstall 2.3.1 --with-openssl-dir=/usr/local/opt/openssl
And this solved my problem!
According to the following question:
How to tell which openssl lib is actually being used by an RVM-installed ruby
It seems that the options --with-openssl-dir=... is no longer valid as of Ruby 1.9.3. I tried
rvm install 1.9.3 --with-opt-dir=/usr/local --with-openssl
and it worked.
macOS Catalina
brew install rbenv/tap/openssl#1.0
rvm reinstall 2.3.8 --with-openssl-dir=/usr/local/opt/openssl#1.0
The following steps worked for me.
First ensure openssl is installed by running brew install openssl, then reinstall the ruby version using rvm, but this time around, you have to pass the with-opt-dir flag pointing to the location where openssl was installed on your machine (use command which openssl to find this location).
rvm install 1.9.3-p392 --with-openssl-dir=/usr/local/opt/openssl
On macOS 10.14, Ruby 2.5.3, and OpenSSL 1.0.2n this worked for me:
./configure --with-openssl --with-openssl-dir=/usr/local/ssl
but I was only trying what the error messages were telling me:
*** Following extensions are not compiled:
openssl:
Could not be configured. It will not be installed.
/Users/brian/Desktop/Ruby/ruby-2.5.3/ext/openssl/extconf.rb:97: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
Check ext/openssl/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
make[1]: *** [note] Error 1
I encountered this issue when working on a Ruby 2.2.3 application.
I had previously uninstalled the MySQL database server on my machine, since I did not need it. However, I still needed the mysql2 gem since my application was connecting to another application's MySQL database to pull data.
However, when I try to run the bundle command I get the error:
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using RVM are
available at rvm.io/packages/openssl.
Here's how I solved it:
The issue was caused by removing the libssl-dev library when I was uninstalling the MySQL database server on my machine and its libraries.
First I ran the command below to reinstall ruby since I installed it using rvm:
rvm reinstall ruby-2.2.3
This raised an error:
Making gemset ruby-2.2.3 pristine............................................./-
.'command gem pristine --extensions mysql2 --version 0.5.3' failed, you need to fix these gems manually.
.
Error running '__rvm_with ruby-2.2.3 gemset_pristine',
please read /home/promisepreston/.rvm/log/1630094455_ruby-2.2.3/gemset.pristine-ruby-2.2.3.log
Next, I tried to install the mysql2 gem:
gem install mysql2
Then I ran into this error:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
mysql client is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.
Finally, I installed the mysql client library using the command:
sudo apt-get install libmysqlclient-dev
Note: This also installs the libssl-dev library alongside.
And everything worked fine.
That's all.
That's what helped me:
rvm reinstall 2.5
brew tap raggi/ale
brew install openssl-osx-ca
brew services start openssl-osx-ca
Found this solution here: https://github.com/raggi/openssl-osx-ca#readme
I specified a more recent Ruby version in my Gemfile, then ran bundle install. All good now.
Specific case for ruby version 3.0.3
By default for brew and system and autolibs OpenSSL version is 3. Ruby 3.0.3 does not work with OpenSSL version 3 and ruby build silently ignores OpenSSL.
To build ruby properly use build options with OpenSSL 1 like this:
PKG_CONFIG_PATH=/usr/local/opt/openssl#1.1/lib/pkgconfig rvm reinstall 3.0.3 --with-openssl --with-openssl-lib=/usr/local/opt/openssl#1.1/lib --with-openssl-include=/usr/local/opt/openssl#1.1/include
Where path variables may be another - check your system.
Thanks to article Ruby 3.0.3 with OpenSSL using MacPorts and RVM
I got this to work on Ubuntu 22.04 by doing:
rvm pkg install openssl
...and adding --with-openssl-dir=$HOME/.rvm/usr to the rvm install command.
This doesn't seem particularly OS-specific and might work on Mac OS as well.
Fix which worked for me
rvm install 3.0.3 --with-openssl-dir=/opt/homebrew/etc/openssl#1.1
PS. Find the correct openssl location in your machine and install ruby pointing to that path like above, mentioning the brew installed openssl#3 path doesnot work.
I don't use rvm, and I don't want to. I had to install asdf in order to resolve what I used to be able to do with just homebrew & ruby.
Following this guide is the only thing that worked for me after following dozens of suggestions. I had to install asdf and update my .zshrc to include the following at the end of the doc:
eval "$(rbenv init - zsh)"
I'm on an Intel Mac running Monterey 12.2.1.

cannot load such file -- zlib even after using rvm pkg install zlib

I installed zlib package and ruby 1.9.3 using rvm, but whenever I try to install
gems it says
cannot load such file -- zlib
The commands I used to install are
$ rvm install 1.9.3
$ rvm pkg install zlib
$ rvm reinstall 1.9.3 --with-readline-dir=/home/username/.rvm/usr \
--with-iconv-dir=/home/username/.rvm/usr \
--with-zlib-dir=/home/username/.rvm/usr \
--with-openssl-dir=/home/username/.rvm/usr
$ rvm use 1.9.3
$ gem install heroku
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
All the help on this subject tells me to just do rvm pkg install zlib, and
then reinstall the ruby with --with-zlib-dir=/home/username/.rvm/usr, but this
didn't work.
I ended up installing zlib from apt-get and then reinstalling ruby to not use the rvm directory for zlib.
Here's how do:
$ sudo apt-get install zlib1g-dev
$ rvm reinstall 1.9.3
[Edit] As commenter #chrisfinne mentions, on CentOS/RedHat based systems:
$ sudo yum install zlib-devel
$ rvm reinstall 1.9.3
The both other responses were almost right...
The rvm site for zlib provides a quick fix!
On the top off the page is a "Quick fix" follow it's instructions, it will:
fix your installation,
provide you instructions what to do to install zlib from your system
and show how to reinstall ruby
Use autolibs to install dependencies:
rvm autolibs enable
rvm reinstall 1.9.3
RVM will automatically install missing dependencies and use them for compiling ruby.
More details on autolibs => http://rvm.io/rvm/autolibs
The solution that worked for me is described in rvm github repo, issue #3389.
Run
rvm install 2.3.0 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8
for ruby 2.3.0 version.
Ruby has a bunch of package dependencies like the one on zlib-devel. They're nasty because there's nothing to indicate you need the library until get some obscure error message while trying to do something routine.
The solution is to use rvm. Use it even if you only need one version of ruby. Why? Because then you can do
rvm requirements
This will probe your particular OS and produce a set of commands you can copy back to the command line to install those missing packages.
rvm pkg install openssl && rvm pkg install zlib && rvm pkg install libyaml &&
rvm pkg install iconv
rvm install 1.9.3-p0 --with-opt-dir=$HOME/.rvm/usr \
--with-libxml2-dir=/usr/local/Cellar/libxml2/2.7.8 \
--with-readline-dir=/usr/local/Cellar/readline/6.2.1

Resources