1

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.

Community
  • 1
  • 1
Aaron
  • 2,672
  • 10
  • 28
  • 45
  • 1
    Give homebrew a try over Macports, I've never had any trouble since I made that particular switch. See for example https://earino.wordpress.com/2012/07/02/macports-x-homebrew-a-quick-story-14/. – Thilo Mar 26 '13 at 19:12
  • One of the most common ways to get Ruby on the local machine is actually through RVM. It has the added benefit of allowing you to have many versions of Ruby installed, and switch between them. Have you tried that out? https://rvm.io/ – jefflunt Mar 26 '13 at 19:13
  • Or compiling Ruby from source code http://www.ruby-lang.org/en/downloads/ – slowpoke Mar 26 '13 at 19:15
  • I did see homebrew and didn't know that was better than Macports. I will try the rvm.io I guess that would be better in case I need other versions on my local system. Thanks for the advice! :) – Aaron Mar 26 '13 at 19:17
  • I updated the post above with what is happening. I tried to use rvm.io and getting an error message there (shown above). Any help would be greatly appreciated. – Aaron Mar 27 '13 at 09:02

4 Answers4

2

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!

Kevin Clifton
  • 509
  • 5
  • 5
  • Thank you very much for your response. It turned out to be a permissions issue. I ran the following command and then it worked... sudo chown -R $USER: $rvm_path – Aaron Mar 29 '13 at 15:50
2

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.

Valera A.
  • 81
  • 1
  • 1
  • 4
  • Nice. This actually needed a little adjustment for me, because I was trying to `$ rvm install 2.0.0.-p0` but I got the OP's error. In my case, the current ruby 2 environment was temporarily set by the installer. So I tried your instructions but I ended up uninstalling and reinstalling rubygems for ruby 1.9... Doing `$ rvm use 2.0.0-p0` followed by your instructions I got a clean rubygems installation. – aercolino Mar 31 '13 at 19:32
  • You might still receive an error after doing the above step, even though rubygems installs correctly. There is a bug in displaying release notes. I have put the relevant links and temporary solution (until rubygems 2.1 is released) below. – Subhash Apr 11 '13 at 03:44
1

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:

  1. https://github.com/rubygems/rubygems/issues/516
  2. https://github.com/wayneeseguin/rvm/issues/1689
Subhash
  • 3,121
  • 1
  • 19
  • 25
0

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
mpapis
  • 52,729
  • 14
  • 121
  • 158