Nil
Nil

Reputation: 361

Ruby on Rails error, Ruby was not installed but it is installed

I have followed this thread and followed Linuxios' answer, everything was working fine but then I get

-bash: export: `[[': not a valid identifier
-bash: export: `-s': not a valid identifier
-bash: export: `/Users/duaneadam/.rvm/scripts/rvm': not a valid identifier
-bash: export: `]]': not a valid identifier

So, I went and removed from .bash__profile via Terminal.

export PATH=$PATH:/usr/local/git/bin/ [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

.. thinking that lines of code is the problem but what I get after that is even worse. For some reasons.. Ruby is not installed.. again. So, I re-added the lines of code and tried rebooting/restarting my Mac but problem still persist. Screenshots:

.bash_profile: .bash_profile Solution please? I even tried re-installing using his method. Gosh, this is hard maybe Ruby on Rails isn't just for me.

Upvotes: 0

Views: 2648

Answers (1)

Gaurav Agarwal
Gaurav Agarwal

Reputation: 14843

Setting up ruby with rvm can get pretty complicated at times. A few golden rules is never to sudo when using a package manager like rvm.

Try the following:

  • rvm implode (This essentially removes the rvm installation completely.)
  • Remove all references of rvm from ~/.bash_profile and ~/.bashrc
  • which ruby (The output should be something like /usr/bin, also ruby --version should be 1.8.7, the default bundled with OS X.)
  • Install rvm again in a single user mode.
  • Install the ruby version of your choice.
  • Make sure to create the .rvmrc file where ever the ruby program resides. (Typical contents of .rvmrc -> rvm use ruby-version@gemset-name --create; eg: rvm use 1.9.3@my-awesome-project --create)
  • cd into the directory with .rvmrc
  • Make sure the right gemset is loaded with rvm gemset list

Also ensure that rvm is loaded as a function. (You can verify this by typing type rvm | head -1 in the console.)

Some more points, which were helpful to me from http://jfire.io/blog/2012/03/02/xcode-4-dot-3-homebrew-and-ruby/:

  • Install apple-gcc42, autoconf and automake (Using a package manager like homebrew can be useful.)
  • Also rvm requirements tells you what are the other tools you need to install.

Cheers!

Upvotes: 2

Related Questions