3

I tried to install ruby version 1.9.3 with this on my mac 10.6.8:

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Oskar-Niburskis-MacBook-Pro:~ oskarniburski$ rvm install ruby-1.9.3-p362
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.6/i386/ruby-1.9.3-p362.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system.............................................
Installing required packages: autoconf, automake, libtool, pkgconfig, libiconv, libyaml, libffi, readline, libksba, openssl, curl-ca-bundle, sqlite3, zlib, gdbm, ncurses...
Error running 'requirements_osx_port_libs_install autoconf automake libtool pkgconfig libiconv libyaml libffi readline libksba openssl curl-ca-bundle sqlite3 zlib gdbm ncurses',
please read /Users/oskarniburski/.rvm/log/1380238189_ruby-1.9.3-p362/package_install_autoconf_automake_libtool_pkgconfig_libiconv_libyaml_libffi_readline_libksba_openssl_curl-ca-bundle_sqlite3_zlib_gdbm_ncurses.log
Requirements installation failed with status: 1.

My version:

Oskar-Niburskis-MacBook-Pro:~ oskarniburski$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin10.0]

Output of log file:

Oskar-Niburskis-MacBook-Pro:~ oskarniburski$ cat /Users/oskarniburski/.rvm/log/1380238189_ruby-1.9.3-p362/package_install_autoconf_automake_libtool_pkgconfig_libiconv_libyaml_libffi_readline_libksba_openssl_curl-ca-bundle_sqlite3_zlib_gdbm_ncurses.log
[2013-09-26 19:30:17] requirements_osx_port_libs_install
requirements_osx_port_libs_install () 
{ 
    __rvm_try_sudo port install "$@" || { 
        typeset ret=$?;
        rvm_warn "There were package installation errors, make sure to read the log.";
        return $ret
    }
}
current path: /Users/oskarniburski
command(16): requirements_osx_port_libs_install autoconf automake libtool pkgconfig libiconv libyaml libffi readline libksba openssl curl-ca-bundle sqlite3 zlib gdbm ncurses
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
--->  Computing dependencies for autoconfError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
There were package installation errors, make sure to read the log.

And then tried to install using MacPorts, but it also did not work again. Any ideas?

Oskar-Niburskis-MacBook-Pro:~ oskarniburski$ sudo port install ruby19
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
--->  Computing dependencies for ruby19Error: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?

Here is my path right now:

/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/usr/X11/bin:/Users/oskarniburski/.rvm/bin:/usr/X11R6/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/oskarniburski/.rvm/bin

Neither of the 'which -a make' nor locate -b '\make'. The first has which command not found, and the for the latter locate:illegal option --b

  • 1
    Umm, did you read the message? Warning: Xcode does not appear to be installed; Doesn't that suggest a possible course of action :) ? – terdon Sep 27 '13 at 0:00
  • Rakso, try installing the latest Xcode following the instructions here. – terdon Sep 27 '13 at 0:07
  • Hey terdon I have xcode 3.2.6, and that is the necessary file for installing xcode on Mac according to that link. So how should I proceed. Is there for some reason, like my path variable, as to why xcode is not being taken into account. I must seem like a hapless soul! – Rakso Zrobin Sep 27 '13 at 0:33
  • Open a new terminal and post the output of echo $PATH. Also, remember to ping me (@terdon) otherwise I don't get notified of your comments. – terdon Sep 27 '13 at 0:51
  • @terdon the path is above in the question now! – Rakso Zrobin Sep 27 '13 at 1:03
2

Problem 1 : make

The first problem is that ruby needs to be compiled and that is usually done through make which will read settings from a Makefile and then call the compiler. On OSX make is installed with Xcode which installs its tools in /Developer/usr/bin rather than the /usr/bin where one would expect. This directory is not in the default $PATH so any executables in it are not found by the shell.

You can fix this for your user by adding this line to your ~/.bash_profile (make sure to add it before export $PATH line) :

PATH="/Developer/usr/bin:$PATH" 

However, this will still not be accessible to any commands running as root (with sudo for example). I recommend you add this directory to the default path. Open /etc/profile, find the line that defines the path there and add the diretory to it. I am on a Linux system but it should look something like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Just add the directory to the end of that so it looks like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/Developer/usr/bin"

If you don't want to change the default, you can link make to a directory that is in the default $PATH:

 sudo ln -s /Developer/usr/bin/make /usr/bin

You'll have to do this for everything that's in /Developer/usr/bin so I really recommend you change the default.

Problem 2 : finding the new version

At this point you should be able to install ruby with

$ sudo port install ruby19

That exits correctly but your ruby version does not seem to be updated:

$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin10.0]

This is because, by default, port installs its files in /opt/local and will install your ruby executable as /opt/local/bin/ruby1.9. Yet another directory that is not in your $PATH. So, you can either repeat the process above and add /opt/local/bin to your $PATH or you can link the ruby1.9 executable to a directory that is in your path. If you add /opt/local/bin to your $PATH, you will be able to run v1.8 with ruby and v1.9 with ruby1.9. If you want all your existing scripts to switch to v1.9, I recommend you make /usr/bin/ruby point to the new version.

The old version at /usr/bin is actually a symlink:

$ ls -l /usr/bin/ruby 
rwxr-xr-x 1 root wheel 76 25 Jun 2010 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

This means you can safely delete it and replace it with a link to the new version:

$ sudo rm /usr/bin/ruby; sudo ln -s  /opt/local/bin/ruby1.9  /usr/bin/ruby

If you ever want to revert and make ruby run v1.8, just run the inverse command:

$ sudo rm /usr/bin/ruby; sudo ln -s  /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby  /usr/bin/ruby

If all has gone well, your default ruby is now v1.9:

$ ruby --version
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin10]
  • Wonderful answer! – slm Sep 27 '13 at 5:45
0

Take a look at this gist. Shows how to install it for Mountain Lion.

Highlights how to using either MacPorts or Homebrew. Once you get that squared away it shows how to install using rvm.

  • Hey I only have Snow leopard on my mac! I have tried going through homebrew to get requirments, but homebrew itself is saying I have a lot of problems, which I have tried to fix with brew doctor to no avail/ – Rakso Zrobin Sep 27 '13 at 0:00
  • You need to install xcode! – slm Sep 27 '13 at 0:01
  • I do have xcode installed though. I can access it through finder and it is on ym computer. – Rakso Zrobin Sep 27 '13 at 0:03
  • What version or xcode? I know that can be a sticking point. – slm Sep 27 '13 at 0:03
  • Hey the version is 3.2.6. – Rakso Zrobin Sep 27 '13 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.