Installation query

I’m new to Ruby and am enjoying it, but when I installed, I attempted to
use RVM and got a series of error messages. I thus decided to use
Homebrew, which worked (as far as I can tell). However, my version is
1.8.7, and I’d like to update to 1.9.3 (I’m running Lion). Can someone
advise the best way to do this? (Apologies for not providing the error
messages, but I’m wary of running AVM again, considering I have a
version that’s working - I recall that one of them was regarding the
./config file, which I realize is not that helpful.)

Thanks

RH

Install ‘rbenv’ and ‘ruby-build’ with Homebrew. After setting up rbenv,
install ruby with ‘rbenv install’ command

Thanks, Alex. I’m not terribly unix literate and have tried to follow
your instructions, but I’m apparently not doing something correctly.
I’ve attached a screen shot of my terminal process.

‘rbenv install --list’ will show you ruby versions available for
install.
Pick one – you will most likely want to ‘ruby install 1.9.3-p362’.

After the installation is complete, use ‘rbenv global 1.9.3-p362’ to set
default ruby version to 1.9.3.

PS. Don’t forget to add eval “$(rbenv init -)” to your ~/.bashrc

You are almost there. You need to tell rbenv install which version you
want.

rbenv install --list

will show you many possible rubies, but seems like you’d want the latest
1.9.3, so…

rbenv install 1.9.3-p362

-Rob

On Mon, Jan 14, 2013 at 3:47 PM, Ron H. [email protected]
wrote:

configure: error: no acceptable C compiler found in $PATH

That’s your problem.
I ready earlier that you are on Lion.
Do you have xcode and xcode command line tools installed?
Install those and try again

Andrew McElroy

Again, thanks to both - however it’s still not working. I’ll paste the
terminal process here:

Rons-iMac:~ Ron$ eval “$(rbenv init -)”
Rons-iMac:~ Ron$ PATH=$HOME/.rbenv/shims:$PATH
Rons-iMac:~ Ron$ rbenv install 1.9.3-p362
Downloading yaml-0.1.4.tar.gz…
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4…

BUILD FAILED

Inspect or clean up the working tree at
/var/folders/mt/7tfxcg6x3r55_033vljxn91r0000gn/T/ruby-build.20130114214558.2141
Results logged to
/var/folders/mt/7tfxcg6x3r55_033vljxn91r0000gn/T/ruby-build.20130114214558.2141.log

Last 10 log lines:
checking for mawk… no
checking for nawk… no
checking for awk… awk
checking whether make sets $(MAKE)… no
checking for gcc… no
checking for cc… no
checking for cl.exe… no
configure: error: in
/var/folders/mt/7tfxcg6x3r55_033vljxn91r0000gn/T/ruby-build.20130114214558.2141/yaml-0.1.4': configure: error: no acceptable C compiler found in $PATH Seeconfig.log’ for more details

OK - I’m getting frustrated. I installed xcode command line tools (I
already had xcode). I then installed 1.9.3-p362 and got a series of
prompts that implied to me that it had successfully installed. I then
closed and reopened terminal and typed ruby -v, which told me that I
have 1.8.7.

???

Stay cool. First, ensure that you have the required ruby version typing
‘rbenv versions’ in the terminal.
You will see something like:

~ rbenv versions

  • system (set by /Users/rherrema/.rbenv/version)
    1.9.3-p362


The above means you have two rubies installed, and that system ruby is
currently the default.
Next, instruct rbenv to set default version to 1.9.3, typing ‘rbenv
global 1.9.3-p362’. That should do it.

I never thought it would be so complicated ^)
Please, ensure your .bashrc contains ‘eval “$(rbenv init -)”’ and
restart terminal session.

But how do I ensure that my .bashrc contains that code? Should there be
a file somewhere called ‘.bashrc’? i don’t find one. I did find one
called ‘rb_outparse.bash’. I’ve attached a screen shot of that.

OK, I’m cool, but still confused. I did as you said, Alex, but ‘ruby -v’
still gives me 1.8.7. Here’s my terminal process:

Rons-iMac:~ Ron$ rbenv versions

  • system (set by /Users/Ron/.rbenv/version)
    1.9.3-p362
    Rons-iMac:~ Ron$ rbenv global 1.9.3-p362
    Rons-iMac:~ Ron$ ruby -v
    ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]

$ open ~/.bashrc

Yes, it’s inside your home directory and hidden.

Alex, I found the .bashrc file and included ‘eval “$(rbenv init -)”’’,
but that didn’t seem to make a difference (unless I missed some other
step).

I followed Carlos advice, found the two versions, and deleted the alias
that was pointing to the old version. Now ruby -v gives me 1.9.

Thanks to both for the help.

This is perhaps not totally resolved. Though ruby -v says 1.9, I’m not
sure that’s what’s actually running. I was expecting that the scope of a
local variable would not override that of a block variable, but it has,
which I understand changed with 1.9. Is there some way I can know which
version is actually running?

Also, when i look in the Library/Ruby directory, there is only a 1.8
folder . . .?

Subject: Re: Installation query
Date: Tue 15 Jan 13 07:18:37PM +0900

Quoting Alex van der Ruchei ([email protected]):

I never thought it would be so complicated ^)
Please, ensure your .bashrc contains ‘eval “$(rbenv init -)”’ and
restart terminal session.

I know nothing about rbenv, but if you type

which -a ruby

you find out the complete path of all the executables called ‘ruby’
that you may execute on your system (included in your PATH). The first
one is the one you execute as default. If you have more than one, the
first one is prolly not the one that rbenv manages (the result of a
past installation?).

If you know what you are doing, it may be sufficient to remove that
executable (or maybe change its name to something like
‘ruby_but_i_do_not_want_to_run_it’, if you want to stay on the safe
side). But it may be that lots of stuff break in your mac. I don’t
know.

The best thing for you is to learn a bit about how a Unix system
works… For example, you can learn about the which command by typing

man which

Manpages are installed as default in macs.

Carlo

The puts RUBY_VERSION command was helpful and revealed that in fact I
was running 1.8. I finally tracked down 1.8 in the folders and deleted
it, and now I’m running 1.9 for real. i must say that the file system is
confusing. There are bin, local, and lib folders on multiple levels. The
main Ruby files are in Cellar. Things for Ruby are spread out all over
the place.

On 01/15/2013 06:06 PM, Ron H. wrote:

OK, I’m cool, but still confused. I did as you said, Alex, but ‘ruby -v’
still gives me 1.8.7. Here’s my terminal process:

Rons-iMac:~ Ron$ rbenv versions

  • system (set by /Users/Ron/.rbenv/version)
    1.9.3-p362
    Rons-iMac:~ Ron$ rbenv global 1.9.3-p362
    Rons-iMac:~ Ron$ ruby -v
    ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]

Hi, Ron

Check your $PATH , maybe your ruby 1.8.7 is before your ruby 1.9.3

confirm 2012070114452332047421859252 zhu soffolk=

Subject: Re: Installation query
Date: Wed 16 Jan 13 04:01:42AM +0900

Quoting Ron H. ([email protected]):

This is perhaps not totally resolved. Though ruby -v says 1.9, I’m not
sure that’s what’s actually running. I was expecting that the scope of a
local variable would not override that of a block variable, but it has,
which I understand changed with 1.9. Is there some way I can know which
version is actually running?

Yup. There is a global constant calld RUBY_VERSION. If you write a
program that reads

puts RUBY_VERSION

and save it as ‘prog.rb’, for example, then you can do

ruby prog.rb

and read the output.

Also, when i look in the Library/Ruby directory, there is only a 1.8
folder . . .?

In Linux, ruby stuff is held in /usr/lib/ruby (or /usr/local/lib/ruby
if you compile ruby by yourself). Probably this is true also with mac?
Have a look…

There is another teeny little pretty unix utility called strace. It
may also be included in macos - I don’t know. One way you can run it
is as

strace -eopen ruby prog.rb

It will print out all files it tries, more or less successfully, to
open. This way you can see in practice where your libraries are being
fetched. For example, in my system a system .rb file is searched for
in 7 places before it is eventually found:

open("/usr/local/lib/ruby/site_ruby/2.0.0/rbconfig.rb",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/site_ruby/2.0.0/x86_64-linux/rbconfig.rb",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/site_ruby/rbconfig.rb", O_RDONLY|O_CLOEXEC) =
-1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/vendor_ruby/2.0.0/rbconfig.rb",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/vendor_ruby/2.0.0/x86_64-linux/rbconfig.rb",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/vendor_ruby/rbconfig.rb", O_RDONLY|O_CLOEXEC)
= -1 ENOENT (No such file or directory)
open("/usr/local/lib/ruby/2.0.0/rbconfig.rb", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/usr/local/lib/ruby/2.0.0/x86_64-linux/rbconfig.rb",
O_RDONLY|O_CLOEXEC) = 5

(btw, rbconfig.rb is the file where RUBY_VERSION is defined)

Carlo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs