I am trying to set myself up on a mac to learn Ruby on Rails, however I seem to be having some problems. If I try to run commands such as ./script/server, i get this:
Rails requires RubyGems >= 0.9.4 (you have 0.9.2). Please gem update --system and try again.
When I run "gem update.." I get this:
Updating RubyGems...
Attempting remote update of rubygems-update
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /opt/local/lib/ruby/gems/1.8/cache/rubygems-update-1.3.0.gem
got it.
sudo gem update --system
Starting with El Capitan, Apple prevents user applications to modify /usr/bin for security reasons. So better install/update rubygems in the recommended folder, /usr/local/bin:
sudo gem update -n /usr/local/bin --system
(recommendation taken from https://stackoverflow.com/a/39928447/1033581)
Related
I am trying to update ruby gems by using:
gem update --system
But I am getting error:
ERROR: While executing gem ...(Gem::RemoteFetcher::UnknownHostError)
no such name (https://rubygems.org/specs.4.8.gz).
Unsure what version of rubygems you have installed, however there are three ways to fix:
network issues - try again later.
the version you have is bricked for updates, and you will need to install another way
NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no rubygems-update installed. You will need to use the following instructions if you see Nothing to update. If you have an older version of RubyGems installed, then you can still do it in two steps:
$ gem install rubygems-update # might need to be admin/root
$ update_rubygems
Failing that you have to get your hands dirty:
Download from https://rubygems.org/pages/download
Unpack into a directory and cd there
Install with: ruby setup.rb (you may need admin/root privilege)
See https://rubygems.org/pages/download for more info
I am trying to install rails , in order to install cocoapods but I am having some trouble with permissions.
I tried $ $sudo chown -R username /usr/ but operation is now allowed.
Username-MacBook-Pro:~ username$ $sudo gem install rails
Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # dir_s_mkdir - /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14
Username-MacBook-Pro:~ username$
You should not install rails with the sudo command for two reasons:
I made this mistake in the past and then I had issues when installing and using other gems because of inconsistencies with permissions. It might very likely cause you the same trouble.
The concern of whether or not to install rails with the sudo command is addressed and well explained in a different post: 'sudo gem install' or 'gem install' and gem locations
The reason why installing gems with sudo is worse than just gem install is because it installs the gems for ALL USERS as root. This might be fine if you're the only person using the machine, but if you're not it can cause weirdness.
I recommend that you install rvm first and then rails. Here is a great tutorial that walks you through the process: http://railsapps.github.io/installrubyonrails-mac.html
I've been poking around the internet looking for a solution on this one... with no luck..
I'm new to rails... If anyone has an idea, I'd love to hear it. Much appreciated!
I enter:
LW:src liamwright$ sudo gem install rails --include-dependencies
And Get:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: could not find rails locally or in a repository
I am running:
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
Mac OS X 10.5.8
I also tried:
gem sources -r gems.rubyonrails.org
And Get:
source gems.rubyonrails.org not present in cache
Just to check...
...try doing a sudo gem update --system before installing Rails to make sure you have the latest RubyGems installed?
EDIT: Actually, if your RubyGems install is really old, you might need to follow the alternate directions on Gemcutter.
Might want to make sure you have the newest rubygems:
sudo gem install rubygems-update
sudo gem update --system
Then:
sudo gem install rails
I came across this solution on Albertux' blox. Running this script will fix it (It worked perfectly for me on an Ubuntu 9.10 machine):
#!/bin/bash
#(download the latest on http://rubyforge.org/frs/?group_id=126)
wget http://rubyforge.org/frs/download.php/43984/rubygems-update-1.3.0.gem
sudo gem install rubygems-update-1.3.0.gem
sudo update_rubygems
# now this work:
sudo gem update --system
echo "done."
I've just had the same problem trying to upgrade rubygems from 1.2.0 to 1.3.7.
Setp-1)
So I just downloaded rubygems-update-1.3.7.gem from http://rubyforge.org/frs/?group_id=126
Setp-2)
gem install rubygems-update-1.3.7.gem
Setp-3)
update_rubygems
and it work for me.
Problem: Cannot install any gem, any type. But I want to install riddle if that matters.
When I run sudo gem install "gem_name" I get the following error:
WARNING: RubyGems 1.2+ index not found for:
RubyGems will revert to legacy indexes degrading performance.
Bulk updating Gem source index for: http://gems.rubyforge.org/
What to do??
Check your sources
gem sources
rebuild index for affected sources, e.g.
gem generate_index http://gems.rubyforge.org
1) Here is the answer!!!!
- slow connection
2) Solution
- move to a new connection.
-
This might not affect people in the 1st world, but I live in China and this was a huge problem as few people seem to have experienced this.
Basically the error means that the connection is to slow and gives up saying no index found. But there is not documentation or help out there on this, except for a few posts about changing gem sources, and MERB causing problems, but all that failed for me.
I was having the same problem and ran the following:
gem env
And saw that I had the following sources in my rubygems configuration:
http://gems.rubyforge.org
http://gems.rubyonrails.org
http://gems.github.com
Based on other answers I've seen here and on the web I decided to remove the rubyonrails.org reference:
sudo gem sources -r http://gems.rubyonrails.org
I was then able to install the gem I was trying to get without the RubyGems 1.2+ index error.
So I'd suggest trimming your list of sources down to just rubyforge and github and then trying to install the gem you want.
I solved this problem by
rm -rf ~/.gem
And then run "gem install" again
Try to add the another gem source. For example github:
sudo gem sources -r http://gems.rubyforge.org
sudo gem sources -a http://gems.github.com
You are running an old RubyGems version.
Upgrade to the latest RubyGems 1.3.x branch.
$ rubygems update --self
If it doesn't work (RubyGems 1.2.0 has a weird bug that prevents --self update) then install rubygems_update
$ wget http://rubyforge.org/frs/download.php/60717/rubygems-update-1.3.5.gem
$ gem install rubygems-update-1.3.5.gem
$ update_rubygems
Use sudo if your os requires it.
Could be a daft entry in /etc/hosts...
I'm following these instructions to set up Ruby on Rails on my Ubuntu machine. For now at least, I'm planning to use Mongrel.
When I get to this step:
sudo gem install rails
...I get this message:
Bulk updating Gem source index for: http://gems.rubyforge.org/
ERROR: could not find rails locally or in a repository
What should I do next?
I would try to update gems first. The latest version is 1.3.3. You can do this on Ubuntu by either:
sudo gem install rubygems-update
sudo update_rubygems
or
sudo gem install rubygems-update
cd /var/lib/gems/1.8/gems/rubygems-update-*
sudo ruby setup.rb
basically, try again!
It could be a serious error, but in earlier versions ( I encountered this about 1 year ago or so ) it happend on the first try and when trying again the gem would eventually be found. I think it had something to do with the servers performance or such.
Using a recent version of rubygems is probably a good idea, and if it really won't work you can always get the .gem file from sourceforge directly and install from it.
For example with the file rails-2.3.2.gem:
gem install rails-2.3.2 –local
gem install rails --source http://gems.rubyonrails.org