Working on a brand new ArchLinux install with rails (4) installed using gem. Logged in as usr instead of root, per ArchWiki recommendation for using gem.
Install is successful, but puts out this warning:
WARNING: You don't have /home/[usr]/.gem/ruby/2.0.0/bin in your PATH,
gem executables will not run.
After much googling, I edited both .bashrc and .bash_profile hoping to rectify the issue.
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u#\h \W]\$ '
export GEM_HOME=~/.gem/ruby/2.0.0
export PATH=$PATH:/home/[name]/.gem/ruby/2.0.0/bin
$(ruby -rubygems -e "puts Gem.user_dir")/bin
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
export GEM_HOME=~/.gem/ruby/2.0.0
export PATH=$PATH:/home/[usr]/.gem/ruby/2.0.0/bin
$(ruby -rubygems -e "puts Gem.user_dir")/bin
I know it's redundant, but I've seen recommendations for both files, and after one didn't work I was hoping the other would.
Either way, even after uninstalling and reinstalling rails, the warning still pops up and rails is still not a usable command. I'm not really sure where to go from here, since it seems those lines tend to fix it for others.
Related
I'm using ubuntu, zshrc, and after installing rails, using
gem rvm all do gem install rails
and getting a successful install, i'm getting a
zsh: command not found: rails
I'm guessing this has to do with my ~/.zshrc file
I have this at the end of it:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
I'm a noob at understanding how paths work, any idea how to get terminal to recognize rails commands?
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"
I just recently switched over to using zsh with oh-my-zsh and I am having issues using the rails command line tool. Here are the steps that I ran through, and the error that I am receiving.
I ran the curl command that the github page provides:
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
Then I went to run rails s, this is the following error message that I receive:
.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
This looks like I am having a gem error so I reinstalled rvm, rails and bundler with nothing solving the issue. However if I switch my terminal back over to bash then I dont have any issues and rails works perfectly fine. Has anyone else run into a similar issue? I want to use zsh because it seems like it has better features but if I can't use rails then I have to dump it to the curb.
These are the lines at the end of my .zshrc file:
export PATH=/Users/thomascioppettini/.rvm/gems/ruby-1.9.3p0/bin:/Users/thomascioppettini/.rvm/gems/ruby-1.9.3-p0#global/bin:/Users/thomascioppettini/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/thomascioppettini/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
What I have done to work bundle zsh and rvm, that is couple of body movies:
1) add to .zshrc at first line to correct find bin direcrory (your CO):
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
2) add next line after previous one:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
3) and at the end change PATH:
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
For me it is work fine (now it correct define $PATH with all rvm gemsets)
did you put the
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
into your .zshrc?
I assume the rvm-installer installs it only into .bashrc
Ok I got it to work by deleting the path that was set in the zshrc and copying the rvm lines from my bash_profile in order to get the right configuration from rvm. If you run the following command in your terminal it should work:
cat ~/.bash_profile >> ~/.zshrc
If you are using rbenv then copy this line from bash.rc which you can access by sudo gedit ~/.bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"enter code here
eval "$(rbenv init -)"
then paste it to zshrc, which can be accessed by sudo gedit ~/.zshrc
I have installed ruby via rvm on Mint 11 no problem. Installed gems, ditto. Installed rails via gem install rails, and when I type rails -v it returns the correct version. Until I close that terminal and reopen a terminal. When I do that and type rails -v I get the message
The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails
If I then type
rvm use 1.9.2-p180 --default
and then type rails -v I again get the correct version...until I close the terminal.
I should add that I have added a path statement to my .bashrc pointing to the 1.9.2-p180 directory in my .rvm directory.
Typing ruby -v always returns the correct version.
Create .bashrc file and add .rvm command
$ sudo touch ~/.bashrc
$ sudo gedit ~/.bashrc
(Add line to .bashrc file)
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
Logout and Login OR just update user profile from .bashrc with following command
$ . ~/.bashrc
Try adding this command to your .profile and reopening your shell:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Use project rvmrc files. You can see how to set this up here http://beginrescueend.com/rvm/best-practices/
That way you keep all your gems seperate for each project and it's dead simple to set up
Try which rails. Maybe there is a link to a stub that gives you the note.
If that is the case calling the full path might help, e.g. /usr/local/bin/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.