Working on Ruby on Rails projects from a Windows (7 x64), I now want to go further and use vagrant with VirtualBox for a prod like dev environment.
Based on the dedicated RailsCast tutorial, then discovering that now Vagrant as to be installed with their installer instead of the gem install vagrant
, I finally got the (Ubuntu) precise32 vagrant provided box up and running \o/
My problem is that if I do a vagrant halt
on host, next time I'll do a vagrant up
(even without changing anything), the loaded system doesn't know about Ruby anymore !
Here is what I do after the needed apt-get install:
cd ~
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source .profile
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
sudo ./install.sh
rbenv install 1.9.3-p327
rbenv rehash
rbenv global 1.9.3-p327
ruby -v
What am I doing wrong ?
From Ubuntu's bash man page:
When bash is invoked as an interactive login shell, or as a non- interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
If you have ~/.bash_profile
or ~/.bash_login
in place, preventing your ~/.profile
from being read. rbenv never gets initialized, so ruby appears to be missing.
Placing those in ~/.bash_profile
should keep ruby visible upon subsequent logins.