I just started reading Michael Hartl's Ruby on Rails 3 Tutorial. He recommends using the latest version of Ruby, currently 1.9.2. My Mac, an original Intel iMac now running Snow Leopard, has Ruby 1.8.7 installed.
Michael suggests installing the latest versions of Ruby and and Rails using the Ruby Version Manager (RVM). So I went to the RVM site and installed RVM with...
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
It seemed to work. A message popped up in the Terminal thanking me for using RVM.
Following Michael's next instruction, which is to make sure RVM is current:
rvm update --head
which results in -bash: rvm: command not found
A footnote suggests that I might need to install Subversion, so installed it, but I still get the same error message when I run rvm update --head.
Any suggestions? I'd really like to move beyond setup and get to building my Rails app.
rvm also gave a message after install saying you needed to add a line to your ~/.bashrc (or equivalent):
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
do that, and then type . ~/.bashrc or open a new terminal.
Related
Namaste!
Wanting to check out the shiny new Rails 5.0, I bumped into an error saying I need to upgrade my Ruby version to a minimum 2.0.0 (my current version being 2.1.3). I use RVM to manage Rubies on my OSX, so I tried the good ol'
rvm install ruby --latest
...only to be told
Already installed ruby-2.1.3.
I ran
rvm known list
...and indeed, the latest version of Ruby listed was the one I already have, i.e, 2.1.3. Next, I checked my RVM version and found it to be 1.25.31, while the RVM blog states 1.27.x was recently released. So I decided maybe this is the reason the known list doesn't show newer Ruby versions and used the documented steps of upgrading RVM from their site. After reloading, I still see the same version of RVM and the same list of available Ruby versions. I tried restarting Terminal too. What do I do now?
Install RVM from scratch
1) First remove the current version, see: https://stackoverflow.com/a/3558763/1076207
# use sudo at your own discretion
rvm implode --force
gem uninstall rvm
rm -rf ~/.rvm
# open file
vim ~/.bash_profile
# remove lines:
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# close file
2) Follow the directions on the RVM install page: https://rvm.io/rvm/install
I just migrated from Windows to Ubuntu, and I am trying to install Ruby 1.9.2 on Ubuntu.
I first installed RVM, and it worked fine.
I ran RVM install 1.9.2 and everything seemed to work fine: it downloaded, configured, compiled and installed everything. At the end, I had the #complete message ... so I thought everything ran fine...
But when I type ruby -v , I get a message
You can get Ruby in the following packages:
* Ruby 1.9.1
* Ruby 1.8
I then tried sudo apt-get ruby1.9.2, and I had a message saying that 1.9.2 would be replaced by 1.9.1
I did RVM install 1.8.7, everything seems to work fine, but I have at the end the same problem: Ruby is not recognized...
Typing which ruby does nothing (no answer, no error message).
I am a bit desesperate here, any idea to help me ?
Many thanks in advance !
Olivier
It looks like you are using "apt-get broken" RVM, follow this answer for instructions how to fix: Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
And here is good tutorial for RVM: http://screencasts.org/episodes/how-to-use-rvm
Used rails on VM running Ubuntu 11.10 but after shutdown says "rails is not installed"
Follow the example I provided at the bottom, it works great.
First:
$ sudo apt-get remove rvm
then...
Copy and paste this into a shell.
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
have fun.
I have had terrible luck with the packaged version of rvm, just install from source via above.
I am trying to install rvm 1.8.7. The command I am trying to use is: rvm install 1.8.7.
I receive this error: rvm: command not found
I am new to system configuration and rvm, can anyone point me in the right direction?
I am using Mac OSX 10.7 (Lion)
I have not installed rvm previously.
If you don't have rvm on your system, then follow the instructions here: Installing RVM. Basically, you have to download a shell script that will does the job for you (fetch the latest release and install it). Then, just add
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
in your .profile, .bash_profile, or whatever you use.
If you have installed rvm already then the problem is that you don't have the path to rvm in your PATH envvar. Include the following in your .bash_profile file:
export PATH=$PATH:/path/to/rvm/bin/directory
I am new to Linux and Ruby. I have been searching for an answer but to no avail.
Using OpenSUSE 11.1
I recently downloaded the latest Ruby 1.9.2 and use the method make install from the source. I did not have the zlib back then.
Now, I cannot use the command "gem -d list ruby". The error says no such file to load -- zlib. I wanted to remove Ruby and RubyGem entirely from the system.
I tried using RVM but i couldn't figure it out on how to use. Been trying to install it for ages, but it is still useless, as the "type rvm | head -n1" comes out to rvm is hashed (usr/local/rvm/bin/rvm) even though I added the "[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session" to both .bash_profile and .bashrc.
Been working on it whole night. Any help is appreciated. Thanks in advance. :)
I had the exact same issue, installed Ruby 1.9.2 on openSUSE 11.4 using RVM. This was a clean install of openSUSE and I was trying to get a Rails development environment set up.
To address this, I removed my 1.9.2 instance using:
rvm uninstall 1.9.2
Then, I installed zlib-devel and openssl using:
sudo zypper install zlib-devel openssl
I then had to delete the 1.9.2 source files from rvm's src folder. This can be found under ~/.rvm/src
The source was there for ruby 1.9.2, rubygems, and yaml. I removed all three, leaving the ~/.rvm/src/rvm folder there in case it was needed by rvm.
Lastly, I re-installed ruby 1.9.2 using:
rvm install 1.9.2
Gems worked after that and I was able to do a gem update --system and gem install rails.
I hope this helps. I see this is an old, outstanding issue.
Mike
There seems to be a lot documented on migrating to 1.9.2 via snow leopard but not a lot on Leopard specifically.
running Mac OS X Leopard 10.5.8
rvm 1.6.3
xcode 3.1.4
I had a hard time installing rvm to begin with- but used this fix and got rvm installed. I type:
$ rvmsudo rvm install ruby-1.9.2-head
Install of ruby-1.9.2-head - #complete
(I get a failure if I try install without a sudo command) To switch default versions:
$ rvmsudo rvm --default use ruby-1.9.2-head
Using /usr/local/rvm/gems/ruby-1.9.2-head
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin9]
When I set it as the default without a sudo command.
rvm --default use ruby-1.9.2-head
I get an error log that ends with:
cp: /usr/local/rvm/bin/rdoc: Permission denied
cp: /usr/local/rvm/bin/ri: Permission denied
cp: /usr/local/rvm/bin/ruby: Permission denied
cp: /usr/local/rvm/bin/testrb: Permission denied
Then I type
$ ruby -v
ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]
But when I close out terminal and reopen it is back to 1.8.7
Any ideas on how to get this ruby install to stick as my default?
Here is my bash profile
PS1="\u$ "
alias ll="ls -lahG"
export PATH="/usr/local/rvm/rubies/ruby-1.9.2-head/bin:/usr/local/bin:/usr/loca$
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loa$
##
# Your previous /Users/mikalfm/.bash_profile file was backed up as /Users/mikal$
##
# MacPorts Installer addition on 2011-04-23_at_21:38:56: adding an appropriate $
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# MacPorts Installer addition on 2011-04-23_at_21:38:56: adding an appropriate $
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.
UPDATE
Solved.
I went to the file location from 'which ruby' (the 1.8.7 version)
Backed up the file and deleted it.
Now ruby -v returns
ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]
See comment below about why this was a bad idea.
Update 2
Solved, Really Unless of course I did something dumb.
So after following the instructions from the thread- I cleared up all of the Sudo issues in the original question. I did it by uninstalling RVM using an implode command, removing the folder and reinstalling without using any sudo commands.
The following problem was I could force rvm to use 1.9.2 as a default for only one session at a time. I just fixed this by reading this stackthread force rails to use 1.9.2 in it someone proposed using the $ echo $PATH command. I did it and it looked fundamentally different than what I thought was in my bash profile.
It looked like
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/mikalfm/.rvm/gems/ruby-1.9.2-p180/bin:/Users/mikalfm/.rvm/gems/ruby-1.9.2-p180#global/bin:/Users/mikalfm/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mikalfm/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin
Turns out, I thought a few lines in my .bash_profile were commented out by ## and weren't.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH and export MANPATH=/opt/local/share/man:$MANPATH. They directly contradict what I thought was my $PATH export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I deleted those lines from my profile. I figure I can add them back in if and when there is a dependency and I need to use Mac Ports again. Again, some one let me know if this is the wrong approach, but it works for me now even when I start a new terminal.
Solved. I went to the file location from 'which ruby' (the 1.8.7 version) Backed up the file and deleted it. Now ruby -v returns ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]
NO NO NO!
The version of Ruby installed by Mac OS in /usr is owned by Apple and installed for their use. Applications installed by Apple use it, and you could have broken them.
If you run find /usr -name '*.rb' you'll find a number of files used by Apple, that are not part of the normal Ruby install.
It's not a problem of 10.5, I use it on my MB pro too. You need to learn to stop using sudo, when you do your not in scope of 'Mikal' anymore. I seldom have to use that anymore.
I'm not too familiar with rvmsudo. What happens when you do
rvm list
rvmsudo rvm list
?
My advice, uninstall rvm installed as root (with sudo), re-try and follow the guide at rvm.beginrescued.com
remove the PATH ruby1.9.2/bin from .bash_profile to avoid confusion. Let rvm handle it, and stay off sudo and rvmsudo (I've never used the latter).
rvm install 1.9.2
rvm use 1.9.2 --default
rvm list #see your rubies
should be sufficient. Hope it helps.
maybe you should just add:
rvm use 1.9.2
to your .bash_profile file :)