RVM and OSX Lion - RVM 'forgets' gemsets on system restart
It appears that your default RVM ruby is not set.
Try running this:
rvm use --default --create 1.9.2@rails3.1
and then rebooting.
If your gemset already exists, you can omit the --create
.
rvm use --default 1.9.2@rails3.1
i'm not using rvm correctly - 'forgets' information on new session
You have a system installation of rvm - /usr/local/rvm
, it is not recommended for basic use (mainly because of the problems you have and many others).
Start with cleaning ~/.zshrc
from forced PATH=
as it is described in this pull request https://github.com/robbyrussell/oh-my-zsh/pull/1359
Then update RVM:
rvmsudo /usr/local/rvm/bin/rvm get head --auto-dotfiles
and restart computer.
There is problem with system installation that it is loading early and the default
ruby is loaded when computer is started, you need to restart computer for the new default to be effective. This problem does not happen when you use user installation of rvm.
optionally
Remove system installation and install rvm for user:
Remove system rvm:
rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm
Restart computer to get rid of environment variables (yes this is required).
Confirm that environment is clear from rvm (should be empty output):
env | grep rvm
Install user rvm:
\curl -L https://get.rvm.io | bash
Using RVM with different gemsets in TextMate
I've found the RVM wrappers method to be very buggy, and as you've discovered it doesn't work at all with gemsets unless you do a lot of tedious setup.
I've had some success using the following script as TM_RUBY
:
#!/bin/bash
base_dir=${TM_PROJECT_DIRECTORY:-$PWD}
cd $base_dir
exec $MY_RUBY_HOME/bin/ruby $*
As long as you're in a TextMate project and you have a .rvmrc
file in the project root it will run your code in the Ruby version and gemset specified in the .rvmrc
. The cd
makes sure RVM discovers the .rvmrc
.
Put the code above into ~/bin/textmate_ruby_wrapper
and then go to Preferences > Advanced > Shell Variables and set TM_RUBY
to that same path.
rvm installation not working: RVM is not a function
You are not using an login shell.
The process of enabling the login flag is described here, also some details on what a login shell is can be found here.
Thus, you need to check the option "Run as login shell" in the Gnome terminal's settings. It is required to open new terminal after this setting the flag.
Sometimes it is required to set the command to /bin/bash --login
.
For remote connections it is important to understand the differene between running interactive ssh
session and executing single commands.
While running ssh server
and then working with the server interactively you are using login shell by default and it's all fine, but for ssh server "command"
you are not using login shell and it would be required to run it with ssh server 'bash -lc "command"'
.
Any remote invocation can have the same problem as executing single command with ssh
.
Mac OS X Mountain Lion Rails is not currently installed on this system.
Use RVM http://rvm.io or rbenv to install newer Rails versions than what come pre-installed with OS X.
Follow examples on the site https://rvm.io/rvm/install/ but basically:
Install RVM: $ \curl -L https://get.rvm.io | bash -s stable
You can then $rvm list known
to see what Rubies are available to you (lots). And simply $rvm install 1.9.3
to get the most current version of Ruby (which as of this writing is ruby-1.9.3-p327
)
Set that ruby as your default $rvm --default use 1.9.3
Create a default gemset to store your gems $rvm use 1.9.3@mygemset --create --default
Then install Rails $ gem install rails
will get you current which today is same as typing gem install rails -v 3.2.9
Related Topics
Error Install Rubyracer with Error "Invalid Gem: Package Is Corrupt"
How to Remove Duplicates in a Hash in Ruby on Rails
Activerecord Connection Warning. (Database Connections Will Not Be Closed Automatically)
What Does +@ Mean as a Method in Ruby
How to Redefine Fixnum's + (Plus) Method in Ruby and Keep Original + Functionality
How to Write an Rspec Test for a Ruby Method That Contains "Gets.Chomp"
Get Chromes Console Log via Ruby Webdriver
Make Rails Ignore Daylight Saving Time When Displaying a Date
Rails 4 How to Call Accessible_Attributes from Model
How to Convert Ppt to Images in Ruby
How to Mark a Cucumber Scenario as Pending
How to Convert Boolean Values to Integers
Rails 5 Db Migration: How to Fix Activerecord::Concurrentmigrationerror
React Error (Only a Reactowner Can Have Refs.)
How to Force a Cucumber Scenario to Fail