Topic: update bash_profile?

I'm using the Amazon API gem called 'aaws' as per this tutorial: http://www.jeffreyjason.com/2010/07/12/ … pi-w-ruby/


I keep getting the error mentioned at the bottom that says: “`require’: no such file to load — amazon/aws/search (LoadError)”

The alleged solution is: don’t forget to set RUBYOPT in your .bash_profile via: export RUBYOPT=rubygems

But I have no idea what that means.  I was able to find my .bash_profile on my local machine.  I set it as follows but I still get the error.  Am I missing something in my syntax?  I know little about bash.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
RUBYOPT=rubygems

Many thanks in advance!

Re: update bash_profile?

Are you on mac (i believe so cause I believe mac has the file named .bash_login where as most other linux systems have .bashrc )?

I had to tweak mine a few times before I got it to work.

Try adding this (in place of [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" ):

[[ -s "~/.rvm/scripts/rvm" ]] && . "~/.rvm/scripts/rvm"

to your .bash_login

What this is doing is initializing the path to RVM, so that when your shell opens it loads the source for RVM. Otherwise, your shell won't recognize RVM and anything that uses RVM will fail.

$HOME is supposed to be a variable for your user's home directory (your home directory). However it failed on mine. So intsead, I gave it a fixed path:

~/.rvm/scripts/rvm

~/ is short for

/Users/your_user_name/

You can also try to load it manually when you open a shell by typing this:

source ~/.rvm/source/rvm

If this still doesn't work it means either:

A) you don't properly have RVM installed
B) You have installed it to another location besides /Users/your_user_name/.rvm/source/rvm
or
C) something else is effed up

Ohh and you still need to type

RUBYOPT=rubygems

too

Last edited by RailsRhino (2011-02-11 00:06:15)

- Ben

Re: update bash_profile?

Whoops

EDIT:

Nevermind what I just posted, that was what I did before it worked properly. I actually had to do this:

create a .bashrc file in your home directory (sometimes .bash_login isn't recognized by certain programs)

if you use textmate and have the command line "mate" installed, you can just do

mate .bashrc 

which will create the file, unless it is already there, and open it.

inside .bashrc put

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Last edited by RailsRhino (2011-02-11 00:11:16)

- Ben

Re: update bash_profile?

Thanks Ben.  I think RVM is working correctly.  My problem is that this article is saying "don’t forget to set RUBYOPT in your .bash_profile via: export RUBYOPT=rubygems" and I'm not sure what that means. 

Here is how I inserted it into my bash_profile and I still get the same error, which says "no such file to load -- amazon/aws/search"

export RUBYOPT=rubygems
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

I probably should have made the title of this thread something more along the lines of "installing ruby-aaws" as that is my problem, not RVM.

Re: update bash_profile?

Well I have never used aaws so I can't answer that. But as far as your question concerning .bash_profile goes, the whole point to .bash_profile or .bashrc is that when you open a shell, the shell reads those files to initialize paths and even functions.

I'm guessing the setting of RUBYOPT is to initialize RUBYOPT to be the path to your gems. Maybe what he means is to set

RUBYOPT=path_to_your_gems

Although I am not sure.

- Ben

Re: update bash_profile?

I tried what you said but still no go.  So I switched to a new gem and funny enough I'm getting the same error. 

I am trying to install: http://rubygems.org/gems/amazon-product-advertising-api

Here's the error I am getting: no such file to load -- amazon_product_advertising_api

I did sudo gem install amazon-product-advertising-api and it told me it installed fine.  I'm guessing it's not installing to the right location?

I am using ruby 1.9.2 and Rails 3 if that makes a difference.  I am not sure if these are just old gems or what?  Any gem I put in my Gemfile and run "bundle install" works fine.  But when I try to install these two gems using gem install or sudo gem install, rails isn't picking them up - it keeps saying no file to load.

Anyone have any thoughts?  I'm googling for this right now but coming up short of solutions.

Thanks.

Re: update bash_profile?

honestly, i could be wrong, but this sounds like you're  having problems with RVM. RVM will install gems and rubies and the like into a certain area. If RVM isn't working, it's installed in another area. Maybe you do have RVM working but you're using sudo to install gems, meaning RVM is installed with root. So when you don't do sudo, or when you don't start the server as root, it's possible that it's using two different locations to find gems and ruby.

when you open bash, type

type rvm | head -1

and see what it says, it should say

"RVM is a function"

The other problem might be the opposite. You installed RVM as your regular user, but you're using sudo to install gems. I believe this would cause you to install gems in one place but not in the place RVM looks for gems. So when you start your server, RVM looks in it's gem location, adn doesn't find the gem you installed.

Make sure you are in sync with where you install gems. If RVM was installed for root user, you must be root user when using it and installing gems. If not, the opposite is true. Don't intermix them.

Last edited by RailsRhino (2011-02-11 12:08:52)

- Ben