2

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"
  1. In my terminal I installed RVM as a user using the standard user github bash script.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

Community
  • 1
  • 1
Jason Preston
  • 1,343
  • 1
  • 10
  • 12
  • What's the output you get for `which ruby`? Should be something like `/Users/username/.rvm/rubies/ruby-1.9.1-p378/bin/ruby`. – Bob Aman Jan 20 '11 at 23:14
  • Here's what I get: /Users/Jasonp/.rvm/rubies/ruby-1.9.2-p136/bin/ruby – Jason Preston Jan 20 '11 at 23:34
  • OK - as more follow up, I seem to have gotten annotate to work. There seemed to be some confusion between the gem in my Gemfile and the gem rvm was referring to. doing "rvm install annotate" and THEN doing the path substitution at the above github link fixes the error. I still dont understand the path issues around rvm - why it looks in one place vs another, but this has worked short term. – Jason Preston Jan 21 '11 at 00:14
  • The RVM site has a lot of information about how its paths work, along with how it manages gems. It has a useful feature called gemsets that might be useful too. If you use IRC, the #rvm channel on irc.freenode.net is very useful as that's where the author hangs out. If you don't have IRC, his email is available via `rvm -v`. – the Tin Man Jan 21 '11 at 03:11

1 Answers1

3

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • Thanks! I did forget to say that I added this to my ~/.bash_profile --- I am assuming that it doesn't matter which file I use, since I would have had to create either. It is not a PROBLEM for me to have my source code is /usr/local/src/ right - RVM can figure the environment out regardless? – Jason Preston Jan 21 '11 at 00:23
  • Where you put your source code is irrelevant. Anything RVM installs will be in `~/.rvm`. "Gem" is bundled with Ruby now, so anything it installs will go into the same `~/.rvm` sandbox. And, under no circumstance do you need to use `sudo` with any RVM hosted ruby or gems, in spite of what any tutorials say. – the Tin Man Jan 21 '11 at 00:29
  • Even though I haven't had this problem, I had a problem when I had one settings in `.bashrc` and the other in `.bash_profile`. I have changed one path but I couldn't see the effect, so I have found out to look in the `.bash_profile` and change there as well. Thanks for marking the important parts of the answer, it gave me a instant answer to my question :) – Aleks Feb 13 '14 at 09:56
  • Don't put it in both, put it in one only. – the Tin Man Feb 13 '14 at 15:58