When I want to run rails server it's not working because I need to define every time RVM source in terminal. Like that
~/.rvm/scripts/rvm
If i restart computer then need to define again source then RVM working..
How can I define it permanently in ubuntu 12.10. Please help me
Try to add command source $HOME/.rvm/scripts/rvm into your .bash_profile
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Similar question was asked here
Related
I installed rvm with rails, from the official website of RVM, I specified the command suggested by the tutorial.
When the installation my system has rails 4.0.0, rvm 01/23/12, ruby 2.0.0, bundler gem 1.3.5 and 2.0.3
But I need to install ruby 1.9 to practice with a course that I am currently doing. "Rails for Zombies 2"
I try to execute the instruction rvm install 1.9.3 and the console returns this message:
rvm: command not found
Possible duplicate of: Ubuntu rvm setup issue
Your problem is that RVM is not loaded when you open a new terminal.
To solve this, run this command line: (if using login-shell)
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Or this (if using non-login shell):
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
Or if you are using zsh (and/or oh-my-zsh):
echo "source $HOME/.rvm/scripts/rvm" >> ~/.zshrc
This will add the path to RVM to load at each Terminal instantiation. You must either close and reopen your terminals or simply call source ~/.bashrc (or ~/.bash_profile or ~/.zshrc).
I had this problem after installing zsh. I'm a domain user so my $PATH and $HOME are not as straight-forward. What worked for me was
echo "source /usr/share/rvm/scripts/rvm" >> ~/.zshrc
The latest installation needs the users to be added to the Group rvm and then need to login again.
Please note that closing the terminal and reopening is not enough; the user has to logout and log back to take the Group addition in effect.
Adding the user to the Group can be done by:
sudo usermod -a -G rvm <user>
The binaries can also be at different locations based on the method you followed during the installation.
I had them at /usr/share/rvm/
You can also look at /usr/local/rvm/scripts/rvm
Then you add this line to the end of ~/.bashrc
[[ -s /usr/share/rvm/scripts/rvm ]] && source /usr/share/rvm/scripts/rvm
Note: If you are using a shell other than bash you may need to add the path accordingly.
For instance, if you using zsh shell add the above lines to the ~/.zshrc file.
I followed this tutorial below:
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
This worked perfectly for me; however, I have one small problem?
Each time I open a new terminal I have to run this command in order for rails to work:
source ~/.rvm/scripts/rvm
What is the problem and why is rvm not recognized
This is what I see after I open a new terminal and verify rails:
robert#rob:~$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Thanks
I highly recommend you to use the official website to install RVM: https://rvm.io/rvm/install
Your problem is that RVM is not loaded when you open a new terminal, this is why you have to manually add the source at each instance of the Terminal.
To solve this, run this command line: (if using login-shell)
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Or this (if using non-login shell):
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).
Take a look at #mpapis comments
I know the above question is very common question. I have gone through multiple posts on this topic. But I didn't get any resolution.
I have installed rvm locally. We already have the installation files. SO went into the folder and run the install command.
$ ./install
Then I checked ./rvm folder in the Users home folde
$ cd ~/.rvm
folder exists. Hence Installation is successful.
Now I am typing rvm in the command line
$ rvm
I am getting below exception
$ rvm
-sh: rvm: command not found
After reading the multiple articles in stackoverflow on this issue, I learned that I have to add the below lines in .bash_profile as I am using Mac OSX 10.7.3
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Even after I am getting same exception while typing rvm. Is there any thing extra I need to do? or Am I missing some thing? Please help
Steps to try out:
Log out and login to your system.
Open a new terminal and manually run
source $HOME/.rvm/scripts/rvm
then
rvm
Check these work-arounds.
Update:
To avoid running
source $HOME/.rvm/scripts/rvm
every time you open a terminal, include this line into ~/.MacOSX/environment in your Mac (This is similar to ~/.bashrc in GNU/Linux-based systems under $home aka ~ directory).
In my case, i am using Ubuntu Bash in Windows 10 and to fix the problem i used:
source /usr/local/rvm/scripts/rvm
For those that are doing this in 2018 just
add
source $HOME/.rvm/scripts/rvm
to your .bash_profile within your home directory.
you need to enable login shell in terminal emulator preferences, sometimes it is needed to use /usr/bin/bash --login, here is an example https://rvm.io/integration/gnome-terminal/
after enabling login shell you need to close terminal application and open it fresh.
I just had to open a new Terminal session.
After I installed it using:
curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.2
For Ubuntu 18.04, I had to run the command below to solve the issue after rvm was installed using instruction from here.
source /usr/share/rvm/scripts/rvm
This is one of other options available for RVM:
source /etc/profile.d/rvm.sh
I'm going through the rails by example tutorial series. I'm trying my best to find solutions prior to asking questions, so if I have missed anything I apologise.
Every time I need to boot up RVM from the command line in terminal I need to punch a command so that RVM initialises: source ~/.rvm/scripts/rvm
Is this normal? It seems that I cant get the RVM commands to work unless I punch in this code prior. Note I only have to enter the command once, not every time I need to enter an RVM command.
Many thanks for your help.
Put this in your ~/.profile or ~/.bashrc:
# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
So you don't have to manually type it for every session.
Further Tip
If you want to use gnome terminal (comes as standard in Ubuntu) with rvm, you can do the following:
Edit the default profile. Check the following setting:
"Run command as a login shell"
This will stop loading the standard .bashrc by default. Fix this by making a soft link of .rvmrc pointing at .bashrc in your home directory
cd
ln -s .bashrc .rvmrc
Try closing terminal and then re-opening it to install a specific version of Ruby as seen in this video at 2:32.
For example, I typed curl -L https://get.rvm.io | bash -s stable --ruby
Then I quit and reopened the terminal, typed rvm install 2.2.3 and it worked.
If your rvm command is not found:
(to check, enter the command rvm list, which gives:)
/bin/bash: rvm: command not found
To solve it, follow these steps:
Install rvm
whereis rvm
rvm: /home/username/.rvm/bin/rvm
source ~/.rvm/bin/rvm
now test your rvm again
rvm list
I am trying to move to GVim(cream) as my primary editor on Ubuntu. I am using the wonderful rails.vim, however I also am using RVM.
Rvm works fine when doing things in a shell, and the ruby version I would like to use in rails.vim is the version set as default (but not the system version).
When I try to run things like
:Rgenerate migration migration_name
I get:
...
Missing Rails 2.3.8 gem.
...
If I try:
:!rvm use default
I get:
/bin/bash: rvm: command not found
Obviously cream/gvim is not using my .bashrc. What can I do to remedy this and get it working? Thanks.
Try running cream from the command line, if this solves the issue you can point your menu item to a script that opens cream in the context of a bash prompt.
This is because you are sourcing the rvm scripts in your .zshrc file. MacVim does not source the .zshrc file, but will source the .zshenv file.
Add following line to your .vimrc file.
set shell=/bin/sh
You probably have used .bash_profile to add RVM stuff to your bash environment. Alas, ~/.bash_profile won't normally be read by X startup scripts, as stated in Ubuntu Help
Use .profile or .bashrc. The .profile is only sourced by bash if .bash_profile is not there. I would use .bashrc.
rvm is a bash function, which changes bash environment. Seems like it is not supposed to be run from inside vim. You can't change the environment of an already-running program.
Try rvm gem list to make sure the rails gem is actually installed. rails (2.3.8) should be listed. If its not run rvm gem install rails.
I'm a vim user, and rvm + rails.vim works fine for me. Including your :Rgenerate example.
rvm is set on a per shell basis, so if you launch a new window or a new tab and you are using something other than your default interpreter and gemset you need to first
rvm gemset use my_rails238_gemset
and then
vim myshiz
Add this line to your ~/.bashrc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
And make sure it comes before [ -z "$PS1" ] && return which stops sourcing the rest of the file if bash is not interactive.
And then add this to your ~/.profile:
export BASH_ENV=$HOME/.bashrc
With this line bash will now source $HOME/.bashrc when it is running non-interactively too.
Both GVim and shell scripts that you execute by double clicking should use RVM now.
Note: Only :! (ex: :!ruby, :!echo) commands will use RVM as commands like :ruby and :echo do not run bash and therefore do not source ~/.bashrc.
Running gvim from the command line doesn't work for me (in the sense that it's not acceptable).
When I am using a GUI application, I want to use it like a GUI, without a useless shell lingering in the background.
The 'set shell=' trick that works for Mac users doesn't work for me. Like you, I am using Ubuntu. Even setting the shell to /bin/bash doesn't do it.
The only thing I've gotten to work is this. First of all, install rvm.vim in addition to rails.vim.
Then, when you open gvim/cream, navigate to your project's root folder then type
:Rvm
This will cause rvm.vim to read your .ruby-version (or .rvmrc) file and initialize itself properly.
At this point,
:Rake
:Rgenerate
...and other rails.vim commands should work just fine.
Note that you can also pass arguments to :Rvm just as you would when running rvm from the shell.