Unable to get ruby running on Mac OSX 10.8.3 - ruby

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

Related

Compass PATH Needs Correcting

I'm trying to play around with Yeoman and I'm trying to use Compass in my scaffold, but the Terminal keeps on throwing up this error when I run grunt.
Warning: Couldn't find the `compass` binary. Make sure it's installed and in your $PATH Use --force to continue.
I think this may have something to do with the way I have Compass installed. I might have installed two copies, one via RVM and another via another method.
Does anyone know how to fix this error. Any help is appreciated.
Thanks in advance!
I ran into the same issue on Ubuntu 14.04 having both the apt-get and the rvm versions installed. I uninstalled the ubuntu package:
sudo apt-get uninstall ruby-compass
Then I re-installed the RVM version following some instructions here and here.
Basically:
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install sass
gem install compass
Then I did a restart and it worked.

Installing RVM on existing ruby1.8 installation

I have a big problem with my Debian server configuration. Someone before me has made a big mess with ruby installation and now i can't manage to get it all working. What i'm trying to do now is to get back to environment, where ruby1.8 is installed and rails app is working correctly with apache+passenger. If it would be working on RVM it would be perfect. Here is the story:
There was ruby 1.8 installed on a server. The person has removed it with sudo apt-get remove ruby1.8 and then installed version 2.0.x manually using those commands:
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz
cd ruby-2.0.0-p247
./configure
make
sudo make install
Then, he has removed all the dirs listed by whereis ruby with rm command.
And here i came - i want to install RVM on this server. The problem is, no matter what i do, i get a lot of errors from all sides. Steps i've done:
# Install RVM
curl -L https://get.rvm.io | bash -s stable
# install 1.8.7 version
rvm install 1.8.7
# use 1.8.7
rvm use 1.8.7
# Install gems
bundle install
First thing (and that's just a tip of iceberg) is that i'm not able to start apache2 in cause of the following error:
apache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Syntax
error on line 1 of /etc/apache2/mods-enabled/passenger.load: Cannot
load
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
into server:
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so:
cannot open shared object file: No such file or directory Action
'configtest' failed.
Looks like there is even no /usr/lib/ruby/ dir on my system right now.
The question is: is there any way to reset all ruby-releated libraries on debian to the original state (debian without ruby installed) and install working RVM on top of that? Thanks in advance for any help.
Verify if, Is ruby installed correct by ruby -v
Install phusion passenger
$ sudo gem install passenger
$ sudo passenger-install-apache2-module
and then follow onscreen instructions

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.

Can't install Ruby Enterprise Edition with RVM on OSX Lion

Here is what I have done so far.
Clean install of OS X Lion
Downloaded and installed latest version of Xcode from the App Store.
Installed Git
Installed Homebrew
Installed RVM
I am now trying to install Ruby Enterprise Edition for a project with rvm install ree and receive the following error:
$ rvm install ree
ree-1.8.7-2011.03 - #installing
ERROR: Error running './installer -a /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03
--no-tcmalloc --dont-install-useful-gems ', please read
/Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting
the installation.
I have already tried CC=/usr/bin/gcc-4.2 rvm install ree and with the same result.
I was able to duplicate your error, just now. This solved it for me:
$ rvm remove ree
$ export CC=/usr/bin/gcc-4.2
$ rvm install --force ree
Using MacPorts you can install Ruby Enterprise Edition, as well as Ruby 1.9.2 for the local user in OS X Lion while having Xcode 4.2 installed by using "Apple's version of gcc 4.2."
Prerequisites:
OS X Lion (tested in 10.7.2)
Xcode 4.2
rvm 1.9.1
MacPorts 2.0.3
Execute the following commands:
$ sudo port install apple-gcc42
$ export CC=/opt/local/bin/gcc-apple-42
then
$ rvm install ree
$ rvm use ree
or
$ rvm install 1.9.2
$ rvm use 1.9.2
optionally
$ rvm use ree --default
or
$ rvm use 1.9.2 --default
I hope this helps.
-Joe
No need to install MacPorts or downgrade to 4.1 to get GCC, I used the installer package at https://github.com/kennethreitz/osx-gcc-installer with xCode 4.2 already installed, and had no problem installing 1.9.2-head and 1.9.2-p290.
I did something similar to what jbg advised. Only I didn't use MacPorts. I just used the latest GCC package for Lion here.
This was after spending about a day and a half trying all of the other suggestions, downgrading to Xcode 4.1, etc. to no avail.
By the way, the direct link to Xcode 4.1 at Apple's site gave me an invalid checksum error, all three times I downloaded it. I saw a Twitter post from someone else who had the same problem.
At the risk of redundancy, I'll post my answer as well, since I tried everything on this page (and many others) and ended up with a hybrid of some of them which seemed the most likely to work. Note that some of these steps may not have been explicitly necessary but they were sufficient (i.e., I didn't go back and remove potentially unnecessary steps to get the simplest path to success).
Environment: Mac OS Lion 10.7.3, Homebrew components, rvm 1.10.2, ree 1.8.7-2012.01, Xcode 4.2.1 with legacy gcc-4.2 available.
Steps:
Ensure that a stable Ruby is current. Used 1.9.2 (rvm use 1.9.2) as 1.9.3 was a potential problem.
rm -fr $rvm_path/usr
rvm pkg install ree_dependencies
rvm remove ree
export CC=/usr/bin/gcc-4.2
rvm install ree \
--with-openssl-dir=$rvm_path/usr \
--with-readline-dir=$rvm_path/usr \
--with-iconv-dir=$rvm_path/usr \
--with-zlib-dir=$rvm_path/usr
I had previously tried the brew-specific solutions but those didn't work for me. Hope this helps someone!
Please do NOT use sudo with RVM, nor do you need to use rvmsudo EXCEPT for when upgrading RVM itself. Please see and read https://rvm.io/support/faq/ (Do I need to use sudo with gems? entry) and https://rvm.io/support/troubleshooting/ (Multi-User Installs - Using the sudo command entry)
Please remove your current installation and start over as using sudo will definitely mess up the permission structure for RVM. Please see the very bottom of https://rvm.io/support/troubleshooting/ (How do I completely clean out all traces of RVM from my system, including for system wide installs? entry)
Then begin again strictly following the Multi-User installation segment of https://rvm.io/rvm/install/
Thank you.
If you are on Lion 10.7.2, and have installed XCode 4.2, you need to downgrade XCode to 4.1
Here's how I did it (it was more complicated than you might think):
Download XCode 4.1 from Apple Dev Center (you'll need to login with your dev centre creds)
uninstall XCode 4.2
$ sudo /Developer/Library/uninstall-devtools --mode=all
remove the XCode installer from your /Applications directory
run the XCode 4.1 package you downloaded, this will install a new XCode installer into /Applications
run the XCode installer in /Applications
When it stops, asking you to quit iTunes, you need to quit iTunes, and also use Activity Monitor to force quit the iTunes Helper
Wait for XCode 4.1 to install
Use the steps outlined above to install ree
Cheers,
Ian
This is how i did to install it. May be previous answers are already solve your problem. My step may be help people who experience same as me.
Frist, Install MacPort latest version
>rvm uninstall ree
>sudo port install apple-gcc42
>export CC=/opt/local/bin/gcc-apple-4.2
>rvm pkg install zlib openssl readline
>rvm install --force ree
Result is:
IronB:~ ...$ rvm install --force ree
Installing Ruby Enterprise Edition from source to: /Users/.../.rvm/rubies/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #fetching (ruby-enterprise-1.8.7-2011.03)
ree-1.8.7-2011.03 - #extracting ruby-enterprise-1.8.7-2011.03 to /Users/.../.rvm/src/ree-1.8.7-2011.03
Applying patch 'tcmalloc' (located at /Users/.../.rvm/patches/ree/1.8.7/tcmalloc.patch)
Applying patch 'stdout-rouge-fix' (located at /Users/.../.rvm/patches/ree/1.8.7/stdout-rouge-fix.patch)
Applying patch 'no_sslv2' (located at /Users/.../.rvm/patches/ree/1.8.7/no_sslv2.diff)
ree-1.8.7-2011.03 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.10 for ree-1.8.7-2011.03 ...
Installation of rubygems completed successfully.
ree-1.8.7-2011.03 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ree-1.8.7-2011.03 - #importing default gemsets (/Users/.../.rvm/gemsets/)
I'm also put this to my ~/.rvmrc for next time
# Make this work with OS X Lion... for now...
if [[ `uname -v` =~ "Darwin Kernel Version 11" ]] ; then
export CC=/opt/local/bin/gcc-apple-4.2
fi

Error installing Ruby 1.8.6 and openssl using RVM under Snow Leopard

I'm trying to install ruby 1.8.6 on Snow Leopard using rvm.
I tried:
rvm install ruby-1.8.6-p111
and got an error explaining make couldn't find openssl.
make[1]: *** [openssl_missing.o] Error 1
I then tried:
rvm install ruby-1.8.6-p111 -C --with-openssl-dir=/System/Library/OpenSSL
(Snow Leopard seems to come with openssl and this seems to be the location)
In the logs I get the same error.
As per http://rvm.beginrescueend.com/packages/openssl/ I then tried to install openssl using rvm like so:
rvm package install openssl
This time, in configure.error.log I get:
[2010-07-07 07:54:28] ./Configure os/compiler darwin-i386-cc -I/Users/craig/.rvm/usr/include -L/Users/craig/.rvm/usr/lib --prefix=/Users/craig/.rvm/usr zlib no-asm no-krb5 shared
target already defined - os/compiler (offending arg: darwin-i386-cc)
I'd really appreciate any suggestions.
I know it doesn't help you much, but thanks for the pointer to "rvm package install openssl" -- it fixed the original openssl_missing.o error for me and everything worked fine from there... eventually.
Here's what I ended up doing to get rvm to work on my laptop, minus some silly MacPorts fiddling because I had some old PowerPC binaries installed in /usr/local/lib.
rvm package install openssl
rvm package install readline
rvm package install iconv
sudo port install ncurses
sudo port install libyaml
sudo port install zlib
rvm install 1.9.2-head -C "--with-openssl-dir=$HOME/.rvm/usr --with-libyaml-dir=/opt/local --with-readline-dir=$HOME/.rvm/usr --with-iconv-dir=$HOME/.rvm/usr"
Ha! I just tried to install rvm on my work computer and ran into your original problem!
Looks like there was a bug in ~/.rvm/scripts/package. Try running
rvm update --head
or
rvm get latest
to get the latest version from git and try again.

Resources