To install RoR on my Mac (v10.9.2), I decided to follow the instructions for Ruby 1.9.2 here: https://stackoverflow.com/a/8464619/2278546
"rvm install 1.9.2" was taking too long, so based on suggestions on SO, I used "rvm requirements" to install each of the requirements individually with macports. I then executed "rvm install 1.9.2" and it ran much faster.
When I tried to execute "gem install rail", I got an error message saying
activesupport requires Ruby version >= 1.9.3
As a result, I went back and tried again with 1.9.3:
rvm install 1.9.3
rvm --default 1.9.3
gem update
gem install rails
This time, during the rails install command, the process got stuck installing the documentation for rails. I decided to interrupt and run this instead:
gem install --no-ri --no-rdoc rails
This worked! I ran the following:
rails new pong; cd pong; rails generate controller welcome index
The last command in that string gave me the following error:
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:17:in
fiddle_func': uninitialized constant Spring::SID::DL (NameError)
from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:30:in
sid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:39:in
pgid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:78:in
set_pgid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:34:in
boot' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:14:in
boot' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:36:in
block in boot_server' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in
fork' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in
boot_server' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:18:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client.rb:26:in
run' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/bin/spring:48:in
<top (required)>' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in
load' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in
<top (required)>' from /Users/me/Coding/pong/bin/spring:16:in
require' from /Users/me/Coding/pong/bin/spring:16:in <top
(required)>' from bin/rails:3:inload' from bin/rails:3:in `'
Based on suggestions read here and here and elsewhere, I decided to try with a different compiler:
port install gcc46
CC=`which gcc-mp-4.6`
rvm reinstall 1.9.3
gem install
rvm reinstall 1.9.3
Same problem with this installation as well.
I suspect interrupting those builds might have left things in a bad state. First off, uninstall 1.9.2. 1.9.3-p545 is the oldest supported version, as of now at least.
Next, uninstall the gem 'spring-commands-rspec' and run a gem pristine -all. Then do another bundle install. FWIW, I am able to run spring on my 10.9.2 macbook. You may have to reinstall the xcode command line tools if your gcc is giving you issues.
Beyond all that, you don't need spring to run a rails app. It's primarily a helper during development and testing. Once you get things cleaned up, I would just remove the thing from your Gemfile until you actually need it.
I was able to get things running by mixing #Andrew's advice with some common sense...
I first cleaned up the mess I had made:
sudo rvm remove 1.9.2
sudo rvm remove 1.9.3
sudo rvm remove 1.9.3-p545
sudo gem uninstall spring-commands-rspec
sudo gem pristine -a
sudo port uninstall rvm
I then reinstalled rvm
sudo port install rvm
and reinstalled Ruby 1.9.3 with rails:
sudo rvm install 1.9.3
sudo gem update
sudo gem install --no-ri --no-rdoc rails
The problem as described above still occurred.
I then remembered that I had received the following message when installing Ruby (confirming Andrew's comment):
WARNING: Please be aware that you just installed a ruby that is no
longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.1 which will have all of the
latest security patches.
So, I cleaned up again:
sudo rvm remove 1.9.3
sudo rvm remove 1.9.3-p545
sudo gem uninstall spring-commands-rspec
sudo gem pristine -a
Then, I tried installing Ruby 2.1.1 and Rails:
sudo rvm install 2.1.1
sudo gem update
sudo gem install --no-ri --no-rdoc rails
This time, I got no errors when I tried to run
rails new pong; cd pong; rails generate controller welcome index
This is not an ideal answer because I still couldn't get 1.9.3 to work, but it fits my purposes (I think). Anyone have any theories explaining why 1.9.3 doesn't work?
Thanks,
Grasswistle
Related
After running:
$ bundle exec rake
I receive this error:
/Users/user/Documents/Code/spree_gem/vendor/bundle/gems/json-
1.8.2/lib/json/ext/parser.bundle: [BUG] Segmentation fault at 0x00000000000418
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64darwin14.0]
Along with this:
/Users/user/Documents/Code/spree_gem/vendor/bundle/bin/rake:23
:in `<main>'
/Users/user/Documents/Code/spree_gem/vendor/bundle/bin/rake:23
:in `load'
/Users/user/Documents/Code/spree_gem/vendor/bundle/gems/rake-
10.4.2/bin/rake:33:in `<top (required)>'
I've tried $ gem pristine --all. Any thoughts?
I had the same error too. Googled around and found these two posts
http://community.onemonth.com/t/install-rvm-error/1883/25
https://bugs.ruby-lang.org/issues/9444
The first post's solution fixed it for me, so for you it would be:
rvm get stable
rvm reinstall ruby-2.1.5
This worked for me:
Uninstall ruby: rvm remove 2.2.1
Install ruby: rvm install 2.2.1
Reinstall rails: sudo gem install rails
Reinstall missing gems: bundle install
Update RubyGems gem install rubygems-update
Reset gems gem pristine --all
Maybe you'll have to rerun bundle install
Try running rails server rails s
Actually, just recalling rvm use ruby-2.2.5 fixed this for me, and is less destructive than the other solutions.
I have got the same error
But below configuration will start working for me.
rvm pkg install iconv
rvm pkg install openssl
rvm reinstall 2.1.5 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr
Also it was working whileI have made in Gemfile by replacing
source 'https://rubygems.org'
this line with
source 'http://rubygems.org'
I have recently been having a lot of trouble with my rubies.
Now whenever I try and run bundle install on my projects I get the following error:
bundle install
/usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler- 1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies': uninitialized constant Gem::Security::Policies (NameError)
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:175:in `<class:CLI>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:6:in `<module:Bundler>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:5:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/bin/bundle:18:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/bin/bundle:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
I have tried reinstalling rubies, I have tried rvm get head and gem update --system
I have also tried uninstalling and re-installing OpenSSL, through rvm package and brew install.
And I have tried completely imploding RVM and starting again, but none of this seems to work. This seemed to happen after I shifted to Mavericks.
Does anybody out there have an idea what might be happening? I have been at this for 3 days...
Edit:
I am having the same issue with all these rubies:
1.9.3
2.0.0-p195
2.0.0-p247
2.1.0-preview1
Assuming you're using brew...
Run brew doctor to check the current state and perform any steps it recommends.
Run rvm list and note which versions of ruby are installed. Remove the offending ruby version with rvm remove 2.0.x where 'x' is the minor revision you are working with, or run rvm remove 2.0 to remove them all.
Now upgrade to the latest rvm, rvm get stable.
Let rvm install dependencies automatically by running rvm autolibs enable. This will allow rvm to install whatever it needs during the ruby installation, including openssl. It will use brew, as I am assuming here, but will also use fink or macports if they are installed instead. In the past I have had problems with brew and macports both installed.
Install the latest ruby via rvm, rvm install 2.0.
Bundler should now work.
When running bundle install on a new rvm gemset running Ruby 2.0 and Rails 4.0 on OSX Mavericks, I was receiving the same error:
gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies': uninitialized constant Gem::Security::Policies (NameError)
Running 'brew install openssl', then 'rvm reinstall 2.0' worked for me.
Have you tried using the --trust-policy=[] option with bundle install?
To Apply the Rubygems security policy named policy, where policy is one of HighSecurity, MediumSecurity, LowSecurity, or NoSecurity.
More - http://bundler.io/v1.3/man/bundle-install.1.html
When trying to update OpenSSL - I broke (seemingly) everything surrounding Ruby and Rails on my laptop. Even after uninstalling ruby and rails through gem uninstall and rvm removeI am still running into this error:
Drews-MacBook-Pro:bookstore drewwyatt$ rails server
bin/rails:3: undefined method `require_relative' for main:Object (NoMethodError)
Everything has been working fine for months until I went mucking around - the worse part is that I'm not even sure what I did to mess things up.
extra info
Drews-MacBook-Pro:bookstore drewwyatt$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
Drews-MacBook-Pro:bookstore drewwyatt$ which ruby
/Users/drewwyatt/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
Drews-MacBook-Pro:bookstore drewwyatt$ rails -v
bin/rails:3: undefined method `require_relative' for main:Object (NoMethodError)
Drews-MacBook-Pro:bookstore drewwyatt$ which rails
/Users/drewwyatt/.rvm/rubies/ruby-2.0.0-p247/bin/rails
Drews-MacBook-Pro:bookstore drewwyatt$
update - installing without sudo
Drews-MacBook-Pro:~ drewwyatt$ gem install rails
Fetching: railties-4.0.0.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/drewwyatt/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks
Drews-MacBook-Pro:~ drewwyatt$
I fixed the problem by completely removing Rails, Ruby, and RVM altogether - then starting from scratch.
I don't remember all of the commands exactly, but it was something like:
sudo gem uninstall rails
sudo rvm remove 2.0
rvm implode
sudo chown -R drewwyatt: ~/.rvm/
rm -rf ~/.rvm
\curl -L https://get.rvm.io | bash -s stable --rails
rvm use 2.0
gem install rails
This came up for me after installing rails with Rails Composer. Seems like a problem with RVM selecting the ruby version, the trick was to simply navigate out and back into the folder.
$ cd ..
$ cd myapp
I was able to resolve this problem by simply running gem install rails.
This problem occurred when I cloned a pre-existing Rails 4 app. I am using ruby-2.0.0-p317, and an RVM gemset specific to this app. I ran the initial bundle install, but then could not run rails console without getting the error.
After running gem install rails, which used the cached copy in my app's gemset, the problem was resolved. Don't ask my why!
Try running bundle exec rails server instead of just rails server.
I was seeing this error because I had a conflicting version of the rails gem installed globally.
Prefixing commands with bundle exec ensures that you're using gems specified by your project's Gemfile.lock.
Similar to #ncherro, I got this using ruby filename.rb. Running
bundle exec ruby filename.rb
works.
I'm having this issue whenever i run "gem install rails":
usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
Ruby and Rubygems were both installed from source. I've installed libyaml from source and from apt-get. I'm running ubuntu 12.04. I am NOT running RVM as far as I know (trying "rvm" returns "bla bla bla not installed apt-get". I'm pretty sure this speaks of 2 separate issues but I need solutions to both. Thanks.
RVM is best tool for easily install, manage, and work with multiple ruby environments.
https://rvm.io/rvm/install/ follow the instructions in this link to get RVM working.
Then you should install 'libtool' before you install 'libyaml'.
sudo apt-get install libtool
rvm pkg install libyaml
rvm reinstall 1.9.3
these commands are using for installing libyaml.
After installing this you can install rails using
gem install rails
My CLI is rusty so be kind...
On OS X Lion I installed RVM and then sudo gem install rails.
When I run plain old rails -v I get:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
and if I run /usr/local/bin/rails I get all sorts of chaos starting with:
WARNING: #NameError: uninitialized constant Gem::VERSION>
# -- encoding: utf-8 --
Gem::Specification.new do |s|
s.name = "bundler"
s.version = "1.0.21"
...but if run sudo /usr/local/bin/rails -v I get:
Rails 2.2.2
...and sudo rails -v`:
/Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in 'to_specs': Could not find rails (>= 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)
from /Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in 'to_spec'
from /Users/dan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in 'gem'
from /Users/dan/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in '<main>'
I am pretty sure I have multiple versions all on top of each other. Any tips to clear this all out and start from scratch?
I think you messed up your system.
If you're using user-level RVM (that's what is recommended), you don't need to sudo when installing gems, because they are installed to a folder in your HOME.
So, here's what I would do in your case:
Clean up. Remove all rubies, gems and RVMs that you can find.
Make sure you cleaned things up.
Install RVM and follow instructions to the letter.
Make sure RVM is activated.
rvm install 1.9.3 (or another ruby of your choice)
rvm use --default 1.9.3 (set default ruby)
gem install rails (no sudo, remember?)
PROFIT!