I have an older mac mini (v10.5.8) I would like to put the latest version of rails on.
gem update --system gives me "no such file to load"
gem install rubygems-update gives me the same thing as above
So I manually downloaded from rubygems.org/pages/download and extracted the tar then tried running ruby setup.rb but that gives me...
./lib/rubygems/core_ext/kernel_require.rb:45:in 'gem_original_require': no such file to load -- stringio (LoadError)
...so I'm stuck now..I'm not sure where to go from here...running ruby -v gives me "1.8.7 (2008-05-31 patchlevel 0"
Instead of using the system ruby, you should try to use rvm to install a recent version of Ruby:
$ curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled --ruby=1.9.3
Or, if you want more control
$ curl -L https://get.rvm.io | bash -s stable
$ rvm get head
$ rvm install 1.9.3
Either way, make sure you run
$ rvm --default use 1.9.3
Note that you may have to install XCode and XCode Command-Line Tools before all of this. Note also that you probably shouldn't use sudo... just have it install ruby for your user.
Related
I'm not trying to manage multiple versions of Ruby although I think that's what I have.
When I run ruby -v it says ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15].
However, when I ran brew upgrade ruby it says Ruby didn't exist. Then I did brew install ruby and it installed version 2.4.0. When I run ruby -v it still says the same thing.
How do I just have the most up to date version of Ruby on my computer?
I have a Mac.
Because your PATH link to your origin ruby, you should add your homebrew ruby path to your .bash_profile like this export PATH=${PATH}:${HOMEBREW_HOME}/ruby
The better way that I recommend is using the rvm https://rvm.io/rvm/install
Follow the step to install rvm/ruby
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash
then copy and execute the shell in bash
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
restart the bash and type which ruby, then it return $HOME/.rvm/rubies/ruby-2.3.3/bin/ruby and your ruby work.
Presently on OS X 10.6.8 if I run
rvm get head
rvm reload
rvm get stable
The highest Ruby is [ruby-]1.9.3-head.
Running rvm get stable does not change this. If I want to install Ruby 2.2 RVM says Version '2.2.2' is to confusing to select ruby interpreter.
Do I have to download the latest (2.2.3) manually and install? Will this not gum up RVM?
You don't say what version of RVM you're running but RVM is plenty capable of handling the problem. From the documentation:
Is rvm get stable not working? Is rvm get latest telling you You already have the latest version! , but you know you don't? Try this:
$ rvm get head
$ rvm reload
$ rvm get stable
If that does not work for you, you can always use the installer to update:
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm reload
Reloading RVM itself won't affect any previously installed Rubies or gems; In other words it's safe.
I'm trying to upgrade Ruby from 1.8.7 to the latest version and Rails from 2.3.14 to the latest version. I ran:
\curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles
and then it tells me to run:
source /home/USER/.rvm/scripts/rvm
in all of my open shell windows, which is just the one so I do that. If I type:
ruby -v
It tells me I have 2.0.0p195 which is okay (although I kinda wanted 1.9.2), but if I close that window, and type the same thing any time I open a shell window again, it tells me I only have 1.8.7. Something similar happens if I try installing Rails after installing Ruby this way.
I'm on Ubuntu 12.04
EDIT:
I'm using RVM. I installed it according to the answer from this stackoverflow question because it was originally a broken version (that's where my command from above comes from):
Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
Try this:
rvm use --default 2.0.0
It occurs probably because your default ruby version is 1.8.7. You can quickly check it with
rvm list
To install 1.9.2, simply type:
rvm install 1.9.2
I feel like a compelte idiot, but I've been wrking on this all day and getting no where.
I've restarted several times trying to get a full install of Ruby on my OSX environment, RVM, Brew, Ruby: and every time I get through to the Ruby install it bottoms out on the rubygems install.
The reason I'm having to start again is that the RVM wouldn't update in Jewelerybox after my first successfull install (used a packaged all-in-one RubyInstaller) so I couldn't manage my gems - a problem caused by the initial Ruby install on the system living in the /usr/local and not under my own directory. To fix this I uninstalled all my Ruby stuff and started again.
All ok until the ruby compiler started gacking on the rubygems install section when installing ruby 2.0.0. Checking out the OSX system files under usr/bin I see that rubygems isn't there either (it should be present by default on OSX). Any ideas? (note that XCode is up to date and has command line tools installed)
Last attempt was:
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm remove 2.0.0
$ rvm install ruby-2.0.0
. . . which fires the following error:
[2013-03-19 23:21:50] /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1073 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/ruby
mkdir -p /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0
...
install -c -m 0755 /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634 /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/gem
rm /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634
ERROR: While executing gem ... (NoMethodError)
undefined method `fu_stream_blksize' for #<Gem::Commands::SetupCommand:0x007ffd0e054818>
Installing RubyGems
Installing gem executable
I had the exact same error installing ruby v2 within rvm today. I was in a user account on Ubuntu who needed to use 'sudo' -- and enter my account password for sudo -- in order to install OS dependencies.
Your question mentions running rvm requirements to install dependencies. That seems to be new behavior in rvm, as of v1.19. It seemed to install a bunch of dependencies just fine. But then installing ruby bombed.
In earlier rvm versions, typing rvm requirements would just list the dependencies for rvm and for ruby, as in Archonic's answer.
I typed rvm implode and then started over with:
\curl -L https://get.rvm.io | bash -s 1.18.21
source /home/deploy/.rvm/scripts/rvm
rvm requirements
At that point I could install the libraries/tools that rvm said I needed for rvm and ruby, and then rvm install ruby-2.0.0-p0 succeeded.
I believe the issue is where RVM places your dependencies - global vs your user folder. From a book called "Agile development with rails":
First, you’ll need to make sure you have Xcode 3 or later installed...
$ xcodebuild -version
If you have Xcode version 3 installed, you’ll need to install the Git version control system separately. Verify your installation by running the following command:
$ git --version
Next, install RVM itself:
$ curl -L https://get.rvm.io | bash -s stable
Exit your command window or Terminal application and open a new one. This causes your .bash_login to be reloaded. Execute the following command, which provides additional installation instructions tailored to your specific operating system:
$ rvm requirements
Look for the line that tells you how to install the necessary OS dependencies for Ruby (MRI). Once you complete those instructions, you can proceed to install the Ruby interpreter itself:
$ rvm install 2.0.0
The preceding step will take a while as it downloads, configures, and compiles the necessary executables. Once it completes, use that environment, and install rails:
$ rvm use 2.0.0
$ gem install rails --version 4.0.0.beta1 --no-ri --no-rdoc
With the exception of the rvm use statement, each of the above instructions need only be done once. The rvm use statement needs to be repeated each time you open a shell window. The use keyword is optional, so you can abbreviate this to rvm 2.0.0. You can also choose to make it the default Ruby interpreter for new terminal sessions with the following command:
$ rvm --default 2.0.0
You can verify successful installation using the following command:
$ rails -v
If you have trouble, try the suggestions listed under the Troubleshooting Your Install heading on the rvm site.
Hope that does it for you!
This worked for me:
rvm get head
rvm requirements
rvm install ruby-2.0
I installed fxruby using
$sudo port install rb-fxruby
As suggested in the book.
It works, my hello world program worked correctly.
Now, though, other code that I have written is broken, whenever I try to use any code that relies on a gem, it does not work. When I do
$ruby -e "require 'rubygems'"
in my code, it gives
"LoadError: no such file to load — rubygems"
When I set my RUBYOPT="rubygems" in my .bash_profile
$ruby -e "puts 'hello world'"
ruby: no such file to load -- ubygems (LoadError)
(it says 'ubygems' without the 'r' on the front, not sure why)
http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.ruby/2008-08/msg00351.html suggests I check my gem location against my ruby location, I get:
$cat `which gem` | head -n 1
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
$ls -l `which ruby`
-rwxr-xr-x 2 root admin 12680 Feb 7 03:40 /opt/local/bin/ruby
I assume this means that the gems are confused, but not sure how to remedy it. Any ideas? It sucks not having gems.
---UPDATE---
Forgot to list versions:
$which gem
/usr/bin/gem
$gem --version
1.3.5
$ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9]
If you installed rb-fxruby via macport it will install the macport ruby as well.
$ port info rb-fxruby
...
Library Dependencies: ruby, fox, fxscintilla
...
But as you can see rb-rubygems (the macport version of rubygems) is not listed as a dependency, so you will have to install it manually.
$ sudo port install rb-rubygems
should do it for you.
It looks like you are trying to use the Apple-supplied gem that works with the Apple-supplied ruby. Did you install the MacPorts version?
sudo port install rb-rubygems
/opt/local/bin/gem