Cannot use RVM commands even after modifying .bash_profile - ruby-on-rails

I am a newbie RoR developer (and pretty newbie for programming in general). I followed the installation instructions on http://rvm.beginrescueend.com/rvm/install/ to a T. I added...
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
...to my .profile and .bash_profile (at the very end) and yet I still cannot load RVM as a function. Note that I am getting -bash: ??: command not found" in Terminal.

Related

-bash: [: too many arguments

How do I get rid of this on my bash terminal?
I suspect that the code that triggers this is found in my .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Removing the line above, gives me back a prompt that Rails cannot be found, even if I have rails installed.
I had the same issue after running rvm get stable.
Since rvm needs to run in the shell session as a function, removing the line [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" from your .bash_profile or .bashrc is not an option as it will cause gems to not be found.
On my environment the cause was due to a conflict between an old installation of bash-it and rvm. If you're using bash-it and encountering this issue, this may help.
I took the following steps:
Backed up my .bash_profile (if you have .bashrc you may want to back it up as well).
Ran bash-it's uninstall script (see instructions in the link above) and removed ~/.bash-it folder.
Reinstalled bash-it.
Added to .bash_profile what was missing based on my .bash_profile backup created on step 1.
Reenabled the bash-it aliases, completions, and plugins that I needed.
As soon as I opened a new shell, I stopped receiving the error and rvm started working properly.

bash_history does not work outside session El-Capitan after installing ruby

in mac osx el-capitan .bash_history has stopped working when i close the window or session after i installed ruby (using either rvm or rbebnv) the last lines recorded by bash_history are;
rvm get stable --autolibs=enable
OR
rbenv install 2.3.0
If i comment out below lines in .bash_profile and .profile, .bash_history resumes...
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *$
OR
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
I want to work on rails with a bash history.
Please let me know if i can get bash history working
I encountered the same problem, it was resolved here.
Simply update your RVM using rvm get head.
You could also create a .bash_logout file with the following:
shell_session_update
Sourced from GitHub comment

Terminator can't find Rails

I started using Terminator, the teminal emulator, but when I run a rails application it can't find Rails.
humberto#asterix:~$ rails -v
The program 'rails' can be found in the following packages:
* rails
* ruby-railties-3.2
Try: sudo apt-get install <selected package>
Does anyone knows how to solve it?
Ensure RVM is Properly Loaded
I don't know anything about your terminal emulator, but it's likely that your environment isn't being properly modified for use by RVM. Make sure your shell sources a file that contains the following:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Depending on your shell and emulator, this is likely to be one of:
~/.profile
~/.bash_profile
~/.bashrc
If all else fails, just create a shell script that contains the necessary line and source it interactively into the current shell. For example, you might create a script and then source ~/bin/my_rvm_setup.sh to set up the correct environment variables and shell functions.
You can simply run terminator from default gnome terminal by the command:
terminator
Than terminator will load paths defined for your default terminal. You can also load RVM on .bashrc file. To do that add this line on your ~/.bashrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

How do I get RVM to be recognised in the terminal on my Mac?

I'm trying to get rails setup up on a mac following this tutorial and a tutorial on rubysource.com
I have installed oh-my-zsh and RVM but when I try the command:
rvm type | head -1
I get zsh: correct 'rvm' to 'rvim' [nyae]?
Which is throwing me because this should display in the terminal:
rvm is a function
If I choose 'n' I get:
zsh: command not found: rvm
and if I choose 'y' I get:
Vim: Warning: Output is not to a terminal
I'm super new to using a mac (bought it yesterday) and am struggling with getting ruby and rails all set up as I do on my windows system.
Any help is much appreciated!
You have probably forgotten to add the line to your .zshrc which loads RVM.
As given at your first link:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
If this line is in ~/.zshrc, then RVM should be loaded when you open a new shell. Otherwise, you'd have to run
source ~/.rvm/scripts/rvm
Whenever you wanted to use RVM.

RVM/Rails installation error on ubuntu 11.04

After upgrading to ubuntu 11.04 I am having this problem with rvm.
I am following this tutorial:
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#top
Git is installed OK, when I follow the instructions on RVM website apparently it's OK too, but when I close my terminal and open a new one and type ruby -v or rvm -v for example I got a message "rvm is not installed".
What should I do?
After some Googling I found:
http://ygamretuta.me/2011/05/09/install-rvm-in-ubuntu-11-04-and-mac-osx-snow-leopard/
which worked for me (Ubuntu 11.04, x64)
Edit your .bashrc file instead of your ~/.bash_profile file with your favorite editor
vim .bashrc
add this to the bottom:
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
Hope this helps guys!
Check do you have ~/.bash_profile and add next code in it (create file if it does not exists):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Also, if you use gnu screen you should add
source ~/.bash_profile
to the end of your ~/.bashrc file.
Then type
type rvm | head -1
in your terminal and you should get message "rvm is a function"
After that you would be able to follow instructions on RailsTutorial.
I recently wrote up a tutorial on getting RVM up and running on Ubuntu 11.04: http://blog.dcxn.com/2011/06/20/setting-up-rvm-on-ubuntu-11-04/
Hopefully it helps if you have future problems or if there are still questions.
I had a similar problem and will list the steps that worked for me:
Following this article was very helpful (even if I have 11.04 installed)
The installation was performed with sudo privileges
The installation didn't added /usr/local/rvm/bin to PATH
Hope this helps to someone

Resources