Terminal - RVM Error - ruby

I am receiving an error message after attempting to install RVM and I need help figuring out why I'm getting this message and how to fix it. When I open up a terminal window, this is the message I receive:
-bash: /etc/profile.d/rvm.sh: No such file or directory
I do have a bash folder in the home directory, however I don't see /etc/profile. I've since uninstalled RVM but this error message still shows, I'm currently running Ruby 1.8.7.
After running rvm implode I received the following message:
Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete
or comment out if this was a Per-User installation.
Also make sure to remove `rvm` group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment
If anyone has any ideas or insight on this I'd be happy to hear your thoughts, I'm kind of at a standstill so any suggestions would help. Thanks.

Try removing rvm from your terminal
$ rm /etc/profile.d/rvm.sh
$ rm ~/.rvmrc
and then check your bash profile
$ open bash_profile
$ open .bashrc
Delete any line that has rvm.

Related

"You don't have [PATH ]in your PATH, gem executables will not run." while using "gem install --user-install bundler"

I was trying to install jekyll in my Mac and got the warning as following:
WARNING: You don't have /Users/Carrot/.gem/ruby/2.3.0/bin in
your PATH, gem executables will not run.
I checked through gem list and it shows it is installed; and I can find the jekyll through the path "/Users/Carrot/.gem/ruby/2.3.0/bin". I read a post which seems like my situation. I would like to know if it's a must to go through sudo? I now prefer to uninstall everything (since it also installed sass and bunch of things at the same time) and go through homebrew. How can I do the uninstallation?
Many thanks!
For those who have problems with #lamech-desai answer, (actually, when they do Desai's commands, it apparently works temporarily for them).
So you can easily do these:
open ~/.bshrc if you would like to use bash or ~/.zshrc if your are using zsh or etc...
$ sudo nano .bashrc ## bash users
$ sudo nano .zshrc ## zsh users
then copy and past these two lines of code at the end of the .*rc file:
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
then simply press ctrl+s and ctrl+x. This will save the changes to .bashrc but you won't see them immediately - directly on your next shell login with your current user. One way to see the changes immediately is to switch user to root with su root and then switch back to your previous user with su <username> - and voila, your .bashrc will be reloaded. You can also check this with echo $PATH.
Thanks to #lamech-desai for great answer
If you are using arch linux just use the commands below in your terminal
[user~]$ export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
[user~]$ export PATH="$PATH:$GEM_HOME/bin"
[user~]$ gem list
[user~]$ gem update
You need to add the directory to your PATH environment variable
https://askubuntu.com/questions/406643/warning-you-dont-have-a-directory-in-your-path-gem-executables-will-not-run
If you are on a Mac like me, you need to add the PATH to the PATH environmental variable. You can do it with export command:
export PATH="/Users/Carrot/.gem/ruby/2.3.0/bin:$PATH"
If you wanna know more about this process, here is a blog post about this: Adding a Path to the Linux PATH Variable
Probably a bit odd to answer my own question but I did finally fix it somehow like a blind fly. I hope to write down the experience maybe who else is totally like me as a absolute beginner with everything wouldn't get struggling overnight.
Stage 1: from gem to homebrew (failed)
At the beginning, I did remove items that install in gem item-by-item, then I install brew-gem to do it. At some stage, it work for jekyll but not my theme. It kept popping out I didn't install a package that the theme needs even I installed it manually. So in the end, I remove everything related to jekyll from homebrew.
Stage 2: back to gem (very long path but finally made it)
I later found a page tell step-by-step to install jekyll. I am using OSX 10.13 (High Sierra) that cause me the permission problem. So I just granted access with this line:
sudo chown -R $(whoami) /usr/local/*
The * is a must or it won't work. I did the same to the ruby part
sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0/*
After that I install jekyll and bundler carefully following the instruction. And install the packages that the theme needs manually through gem install, which you can find at the Gemfile. I got the problem of jekyll-sitemap similar as this, I followed the method to install pygment.rb through gem install pygments.rb. And now my site is locally work.

RVM + Zsh "RVM is not a function, selecting rubies with 'rvm use ...' will not work"

I'll start by saying I'm not an expert at command-line, so I really only barely know what I'm doing.
I cannot get RVM and oh-my-zsh to play nice together. I've tried several different solutions posted around, some on SO, but nothing I have found seems to fix the issue.
Initially, someone else setup RVM on my machine. I later setup oh-my-zsh myself, and remember having a lot of trouble doing so.
My .zhsrc file is completely default except for these 2 lines
export PATH=$HOME/bin:/usr/local/bin:/usr/local/rvm/bin:$PATH
#pretty sure this line does nothing, although I've seen this fix around
# several places. I noticed that I don't seem to have an .rvm file in my
# home directory which would be an issue, but I have no idea how to
# go about correcting this.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
I added the /usr/local/rvm to the Path directive as zsh returns zsh: rvm command not found without it there. Otherwise most rvm command work, with the exception of rvm use which throws the following error:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
I have ensured the profile preferences on my profile in iTerm2 are set to "Login Shell" as recommended by RVM
I have tried changing these preferences to the "Command" option and using the recommended /bin/bash/ --login as the command, however zsh no longer appears to work when this happens. Changing the command to /bin/zsh/ --login allows zsh to work again but does not solve the problem as I still get the "RVM is not a function" error when trying to run rvm use
The default ruby in RVM is set to 2.0.0. I can run ruby -v in my home folder and get the ruby version output which shows the default version.
Working on rails projects, I can run all rails commands IF the Gemfile specifies ruby 2.0.0, the default. However on a project that uses a different version, I get the following error:
Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3
Then I cannot run rvm use 1.9.3 as it returns the above mentioned error.
How can I make zsh play nice with RVM?
Some info about my setup:
Mac OSX 10.9.1 (Mavericks)
iTerm2
Zsh 5.0.2 with oh-my-zsh
RVM 1.5.1
For me, I just had to add
source $HOME/.rvm/scripts/rvm
to my ~/.zshrc and it started working, after having the same error message as in this SO question.
Turns out that RVM was installed in the wrong place. When I had initially installed RVM I believe I did so with the sudo command, which ran the multi-user install (installed to /usr/local/rvm), and not the single user (should be in ~/.rvm/scrips/rvm), which is why all the posted solutions were not working for me.
I had to uninstall RVM with rvm implode. There were some permissions issues, so I had to manually go in and delete the files that could not be deleted. Ran the curl command to re-install RVM and now it's installed in the correct place.
Sourcing RVM in my .zshrc with [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" now works properly and I can switch between rubies.
#trustkr's answer worked for me, but would like to add...
I ran into this issue immediately after install of rvm. In order for the
source
to work in in the ~/.zshrc file to work, you will need either start a new terminal session and work there OR you can run
source ~/.rvm/scripts/rvm
in the same terminal session in which you installed.
[Mac OS 10.10.5 - iTerm - zsh]
I had the same issue added this one line at end of .zshrc file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
and works now everything works fine on my ubuntu 16.04 operating system :)
You need to run the following:
$ source ~/.rvm/scripts/rvm
then run this
$ type rvm | head -n 1
and the result will be like
rvm is a shell function from /home/sun/.rvm/scripts/cli
Hope that helps!
Another solution :
1) In the terminal run :
which rvm
The output in my case is ---> /usr/share/rvm
2) Open .zshrc file
nano ~/.zshrc
add "source + the_path_to_your_rvm + /scripts/rvm", in my case it's :
source /usr/share/rvm/scripts/rvm
3) save the file (.zshrc)
4) close the terminal and open it again

Warning! PATH is not properly set up, usually this is caused by shell initialization files

Whenever I go to a folder with a .rvmrc file, there is a warning:
Warning! PATH is not properly set up, '/home/me/.rvm/gems/ruby-2.0.0-p247/bin' is not available,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
to fix run: 'rvm use ruby-2.0.0-p247'.
I did rvm use ruby-2.0.0-p247, but the warning is still present.
Note: There are no errors, Im able to run my application just fine, but the warning is very annoying. Any ideas?
I was getting the same warning even after upgrading RVM to version 1.25.16. I was able to fix the warning by running:
rvm reset
Then when I ran:
rvm version
I did not receive the error anymore.
If you know what you're doing, and your PATH is set to what you want, you can suppress this message by putting the following in your ~/.rvmrc:
rvm_silence_path_mismatch_check_flag=1
This is handy if you use other path-manipulating programs like virtualenv, or if you just want to prefix your path with ~/bin or something.
I was able to get rid of this by doing
rvm get head
This was a bug and was handled with https://github.com/wayneeseguin/rvm/issues/2050 and was released as rvm stable 1.21.15 at 2013-07-29 19:15:30 -0700
I had the same problem too, and rvm get head didn't work for me, finally it was solved by running rvm get head --auto-dotfiles, then restarted the terminal and the annoying warning message disappeared! And the solution is found here: https://github.com/wayneeseguin/rvm/issues/2074
Hope this will help.
rvm get stable solved this for me
(as pointed out in comments on another answer by AndrewMarshall)
Okay, so I ran an export PATH command without realizing the implications and ran into the identical error, but I also lost all control of my typical commands like cd and pwd. I didn't want to reset the rvm tools I'd already installed per some of the answers above.
First attempt was to some sort of mac default path (found on google):
$ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
Which actually solved my first problem of not having access to my typical command line tools, but was still getting the same error as #Santosh's initial problem. The next thing I did was navigate to my directory where I've set up rvm to start, and then to run a new export command as follows:
$ export PATH="$PATH"
This was how I initially set up rvm, and no more errors. Hope this helps someone
Make sure that you add the following at the end of your
~/.bash_profile OR ~/.zshrc file.
In this example our ruby version is ruby-2.6.1. Replace this with your ruby version.
export PATH=~/.rvm/gems/ruby-2.6.1/bin:$PATH
# RVM manual script for loading rvm to shell
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
This works for me.
Solved!
Warning! PATH is not properly set up, '/home/vaibhav/.rvm/gems/ruby-2.3.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.3.1'.
rvm get stable --auto-dotfiles
Next you might get below Error:
RVM is not a function, selecting rubies with ‘rvm use …’ will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Temporarily solution
I solved it temporarily by running source ~/.rvm/scripts/rvm it is the only solution it worked for me. but you have to run it every time you close the terminal. at least solves your emergency

I'm getting "RVM is not a function" error on Mac OS X, and no posted solutions work

I'm on Mac OS x 10.8.2 ("Mountain Lion"), and I successfully installed RVM 1.17.8 and its dependencies. I'm able to use it to install Ruby versions using rvm install 1.9.2, but I can't execute rvm use <version> without getting this error:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
I have the following in ~/.bash_profile, which I have set to run, using source ~/.bash_profile, whenever a terminal window is launched:
export SVN_EDITOR=vim
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[ -r ~/.bashrc ] && source ~/.bashrc
I've tried running source ~/.rvm/scripts/rvm, which runs without returning an error, but I still get the "RVM is not a function" error when I try to use RVM to set the Ruby version within the terminal session.
I also tried uninstalling and reinstalling RVM using rvm implode. I've run out of ideas and I can't seem to find any more solutions online. Help?
Make sure your shell initialization files are set up properly:
rvm get head --auto-dotfiles
Then go to your terminal emulator preferences and enable login shell, sometimes it it required to use /bin/bash --login.
Also make sure to fully close terminal and open it fresh after changing the setting.
The solution ended up being on the RVM Help & Support page, in the ".bash_profile not being loaded on OSX" section. It seems that the issue was that I had my terminal set to open with the "default login shell" and when I changed it to instead open with the command "/usr/bash" in Preferences/Setup, "source ~/.rvm/scripts/rvm" started working, and rvm is now being recognized as a function.
look for .profile, if exists, remove it! loof for .zshrc, if exists, remove it! Now, use vi to edit your .bash_profile, add this line
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Now, close all console services and open again, make a test using
$ rvm gemset use global
Work fine for me!

Ruby Version Manager broke my $PATH

I installed RVM on OSX and now my $PATH variable is totally changed. I tried to change it in .bashrc and .profile but it doesn't seem to have any effect. Any ideas what I'm doing wrong?
It looks like you have some misuse in your RC files, have a read here: https://rvm.io/support/faq/#shell_login
basically .profile should not be used as bash login RC script, there is .bash_login or .bash_profile which are better choice for it.
to fix your profile files you need to run:
rvm get stable --auto-dotfiles
and restart computer - yes restart the machine, it's only a minute on mac
I ran into this problem when I had an rvm binary in /opt/local/bin (a macport called 'rsync vault manager'). After uninstalling that, rvm stopped removing /opt/local/bin from my path.

Resources