Installing Ruby on Mac 1.9.2, still getting 1.8.7 even though path changed - ruby

I'm on a Mac running 10.6.4 Snow Leopard, and apparently ruby comes ready to go. But I'm new to Ruby, trying to learn the Rails framework, and so i decided to install the latest version 1.9.2. I followed the instructions here, but after I compile and install, when I run ruby -v I'm still getting 1.8.7. Anyone can help a noob out?
When I use which ruby I am getting usr/local/bin/ruby, so the path has changed and is correct.
UPDATE:
It seems I was having issues because I was using two login files to set my path (.bash_login and .profile). You can only use one, and the first one that exists and is readable will be used. I eventually switched to RVM and used .bash_login to load RVM into shell.

Well, the sw isn't lying to you. So something is not as you expect.
Try /usr/local/bin/ruby -v and see what version it is.
Added: Also, try locate ruby|more to see where the ruby files are on your system.
You may need to change your path to use your newly installed copy of ruby.
Added more: did you add the Path to your ~/.profile file as the instructions tell you to do in step 1?
Did you restart your terminal session after changing the ~/.profile file? (Quit and restart terminal.)

Related

RVM trying to load old Ruby version

UPDATE: I just quit all instances of Terminal and opened a new window, and apparently the message is not showing anymore.
I uninstalled ruby-2.1.0, installed ruby-2.1.3 and made it the default with RVM on Mac OS X.
Now everytime I open a new terminal window I see this:
ruby-2.1.0 is not installed.
To install do: 'rvm install ruby-2.1.0'
I looked on .bashrc, .bash_profile, .profile and .rvmrc, but I don't see anything trying to use ruby-2.1.0. I also updated the .ruby-version files.
rvm list shows ruby-2.1.3 as the current and default ruby.
How do I stop that message from appearing?
When you go into a Rails project directory in your terminal, RVM looks up the .ruby-version file and if it finds it, it checks the Ruby version specified inside this file, then if that Ruby version is not installed on your system by RVM, it gives you the message you are getting.
This is actually very helpful, allowing to know your project is using a Ruby version which is not installed on your system
The solution for me was to just quit all instances of Terminal and reopen it.
If anyone else is having this problem, check also Ali's answer regarding the .ruby-version file.

Change back to bash from zsh? OSX Lion

I am trying to setup my computer for Ruby on Rails development. All new to this.
Though I have had some problems with my Rails installation and want to reset everything and start again on setting it up.
The problem I get now is installing and using bash in Terminal except of the installed zsh.
I´m trying the command ➜ ~ rvm install 1.9.2
but only get:
zsh: correct 'rvm' to 'rvim' [nyae]?
which opens the file in an texteditor.
Isn´t it supposed to be a downloadable file, which should be installed automaticly ?
It sounds like rvm is not on your path. You could specify the executable location explicitly:
~/.rvm/rvm install 1.9.2
(or maybe /usr/local/rvm/rvm depending on where you installed it)

How do i install Command-T, Pathogen, and not using RVM?

I used brew install to install ruby (as opposed to RVM). I have on my system installed ruby 1.9.3p0. (OSX Lion)
I'm trying to install Command-T via pathogen. I can normally run rake, make, ruby, whatever, but when i enter into the 'Command-T' directory and try to run rake make it says Could not find rake-0.8.7 in any of the sources.
I also cant run any normal ruby command. just ruby --version produces the same errors.
I know this has to do with below... but i dont know how to actually fix it.
Most installation problems are caused by a mismatch between the
version of Ruby on the host operating system, and the version of Ruby
that Vim itself linked against at compile time. For example, if one is
32-bit and the other is 64-bit, or one is from the Ruby 1.9 series and
the other is from the 1.8 series, then the plug-in is not likely to
work.
As such, on Mac OS X, I recommend using the standard Ruby that comes
with the system (currently 1.8.7) along with the latest version of
MacVim (currently version 7.3). If you wish to use custom builds of
Ruby or of MacVim (not recommmended) then you will have to take extra
care to ensure that the exact same Ruby environment is in effect when
building Ruby, Vim and the Command-T extension.
I tried temporarily moving the entire Cellar directory out of /usr/local (for those arent familiar, its where homebrew installs ruby and everything else).
In terminal if i run which ruby it works right.. yet when i rune rake make in the Command-T folder it still gives the same error
nevermind... all i had to do was run /usr/bin/rake make
how thats different than just removing the Cellar folder temporarily so that by default shell uses that path, i have no idea, but it worked.
I had similar problem on Fedora.
In the end, I found we should install rubygem-rake and ruby-dev package first.
After installing both, compile your Vim with "./configure --enable-rubyinterp",
then Commend-T will be ok.

Why doesn't rails.vim recognize any gems that I install?

I'm a ruby and vim newbie. I recently installed the rails.vim plugin and all the commands work fine apart from the commands to create a new Rails project. Every time I do this it says rails is not installed on my system, but it is! It also acts up when I create a class that requires a gem that I've installed. Can anyone help with this?
Did you rvm use system before building / brew install-ing macvim? I didn't and got many errors. Doing rvm use system beforehand fixed things up for me.

RVM causing path issues with installed gems on Ruby 1.9.2 - unable to annotate, etc, do I need to reinstall RVM?

I'm on Mac OSX Snow Leopard. I tried to post a similar question to the RVM Google group but it did not seem to get posted.
I'm worried that I've done something fundamentally wrong with my RVM install that's causing these errors, that seems to be related to paths, at each step of the way. Have any of you seen this behavior before?
I started to teach myself Rails programming as of about two months ago with a working environment of Ruby 1.9.1 and Rails 3.0.3, based on a hivelogic install tutorial that had me modify my ~/.profile file and install the relevant bits to ~/usr/local/src/. For reference, the line in my ~/.profile file was this when I installed RVM, if that makes any difference:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/src:$PATH"
In my terminal I installed RVM as a user using the standard user github bash script.
I tried to install Ruby 1.9.2, which kept running into a weird error about a libfile somewhere. After much Googling I found someone on Stack Overflow that recommended renaming the ~/usr/local directory while performing the Ruby install -- I did this, and the install complete.
Then I did gem install rails and tried to do bundle install in my app, which gave an error when trying to install the SQLite3 gem (even though I already had SQLite3 installed and working). Again, I spent a day Googling this and eventually found "Unable to install sqlite3-ruby gem" that said if I used Macports to sudo port install sqlite3 it would work.
I tried that from the base directory, and Macports did its thing but it didn't fix the problem. Then I did the same thing from my app directory and it fixed the SQLite3 error I was getting.
Now I am able to run rails server and rails generate again, which is great, but then I tried to "annotate" my new model, and I get this error: http://pastie.org/1481570
I have not yet solved this issue, and have looked at many threads of similar issues. This, for example, did not solve my problem: https://github.com/james2m/annotate_models/commit/5997da9692c9b222e8d1be22dfad6ed8638c16a1
I even tried copying my source code directly into the rvm/user/ directory in case that relative path was causing problems, but it doesn't seem to have fixed anything. Maybe I need to uninstall RVM and re-install it as root instead of a user-level thing?
What do you think is the best way to get annotate to work and hopefully get RVM to play nice with my gems going forward?
I'm unfortunately REALLY new to terminal, code, etc, so any help would be much appreciated.
On Snow Leopard you should modify either ~/.bashrc or ~/.bash_profile, preferably the later. Also, RVM will not need anything in ~/usr/local since it's entirely self-contained in ~/.rvm.
RVM uses a nice little shell function to sense the needed directories and desired default Ruby. I suspect either the instructions you followed were very out of date, or poor recommendations. The current RVM installation requests you add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
to your ~/.bash_profile
The RVM site has lots of troubleshooting tips for things like MySQL. I'd strongly recommend backing out of the things those other tutorials had you do, and refer to the instructions on RVM's site. It is very easy to get things working right if you do it the RVM-way.
Download and install Apple's latest version of XCode from their Developer site if you haven't already. There have been some broken versions shipped on the DVDs.
Install. In particular follow the "Post Installation" section.
Following that, do whatever rvm notes says to do as far as libraries. Following that, you should be able to use rvm info to gather useful info about your installation. It is your best friend.
Database integration will point you to how to fix MySQL's wagon.
RVM development happens fast. Keep it updated, at least once a week using rvm get head.
At that point you should be in a good place to start reinstalling gems.

Resources