I have some issues with upgrading my Ruby version with RVM on OS X.
RMV uses MacPorts, causing me to run sudo port selfupdate, which gets a bunch of compiling errors, despite correct Xcode command line tools installed.
I found some installation instructions using Linux apt-get but unfortunately I don't have in it on my Mac.
I want to install Ruby without RVM. How can I do that?
In case Macports does not work for you, try Homebrew:
rvm autolibs homebrew
Please note: Although it is not required, you might want to install Homebrew before using it with autolibs. It keeps Homebrew out of RVM directories.
Using Homebrew, you can either install and manage a single version of Ruby:
brew update
brew install ruby
Or, even better, use rbenv as a flexible alternative to RVM:
brew update
brew install rbenv
brew install ruby-build
rbenv install 2.0.0-p247
rbenv rehash
rbenv then makes it easy to use a specific version of Ruby either globally or per project (which can then be added to source control).
Note that you may want to follow the advice from rbenv's "caveats" (brew info rbenv), particularly the part about adding eval "$(rbenv init -)" to your profile.
Related
Using brew I go though the normal install process to get rbenv and Ruby installed.
Everything goes smoothly but it is soon apparent Ruby did not install with openssl onboard.
The only thing that seems to allow rbenv to auto install openssl during the ruby install is to use this:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include
Is this a bug in rbenv or brew that needs fixing?
There's a long thread about rbenv with openssl on Github here
The easiest way to fix it are:
1) Update to the latest version of rbenv where they fixed the CONFIGURE_OPTS options, then delete and re-build all your ruby versions.
2) Use the older version of rbenv and explictly set the CONFIGURE_OPTS to use the brew openssl:
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install <whatever version you need>
I've just installed Mavericks OSX, loosing my previous ruby versions which I used to work in several Redmine based projects. Not to say I'm currently not happy with apple.
Anyway, I'm following #RyanWilcox steps described here to install a ruby version prior 2.0.-
Trouble downgrading Ruby on OS X Mavericks
which looks promising, but sadly I'm stuck installing ruby through macports. When I run
sudo port install ruby
everything seems ok, but then it get stuck in
---> Building gettext
step. I'm not a macports user and have no idea what's happening here nor even where should I start looking. Anyone could point me in the right direction to fix this issue?
Did you install the xcode command line tools? Try xcode-select --install first.
I also suggest you to use Homebrew instead of MacPorts. Here are the steps to install rbenv via Homebrew: https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x
brew install rbenv ruby-build
rbenv init
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile && source ~/.bash_profile
rbenv install 1.8.7-p374 # or any version listed in `rbenv install -l`
rbenv local 1.8.7-p374
Now 1.8.7 is the default Ruby version for your user.
In my case, I had to switch to Xcode5 command-line tools, using xcode-select -s <Xcode5 Developer folder path>, because I had two versions of Xcode (4.6 and 5) on my machine and at the time of building ports I was using Xcode4 command-line tools.
Also, I enabled multi-core build in /opt/local/etc/macports/macports.conf by setting buildmakejobs field to:
buildmakejobs 2
This made the build process much faster, so that there are smaller chances that it would give you false impressions that it got stuck elsewhere.
I have installed rbenv in my vagrant machine but when I try to list all the available ruby versions rbenv versions then it gives me this output:
system (set by /home/vagrant/.rbenv/version)
Does anyone know what is this?
Are you asking what the output of that command means? I'm looking at the rbenv documentation, and I think it indicates that rbenv only knows of one version of ruby - the version that came installed with your system.
Edit: If that's not the answer you were looking for, can you tell us what you expected to see? Did you have other versions installed on that machine?
Edit 2: If you want to see a list of versions you can install onto your machine, but aren't installed yet, run:
rbenv install --list
Here is more documentation for this command. This will help!
If you have tried both rbenv install --list and ruby-build --definitions and still can't see the latest Ruby versions on the list, then you need to upgrade ruby-build because that is what rbenv uses to "know" the available versions.
For example, assuming you use Mac OS X and installed ruby-build using Homebrew, you can update ruby-build by invoking:
brew upgrade ruby-build
Now, try listing the available versions again, and you should see the latest ones there.
Edit:
The ruby-build wiki lists a couple of ways of updating it, namely the above one using Homebrew and another one where it is installed as a plugin to rbenv:
cd "$(rbenv root)"/plugins/ruby-build && git pull
Rbenv is usually installed with it's companion ruby-build
You can get the versions available to be installed with:
ruby-build --definitions
To get a list of available ruby versions you can install, type the following:
rbenv install -l
To get a list of the ruby versions already installed on your machine, type the following:
rbenv versions
To answer your question as to what the below means:
system (set by /home/vagrant/.rbenv/version)
This is telling you that the system ruby (the default ruby installed on your system) is the only ruby version installed on your vagrant machine. Rbenv is using the default system ruby because it doesn't have any other ruby versions installed yet.
To see all available versions:
rbenv install --list-all
Or
rbenv install --list
To list only stable releases for each Ruby implementation.
If you are on Mac
brew upgrade rbenv ruby-build also works.
Documentation
List rbenv versions that are possible to install
"Only latest stable releases for each Ruby implementation are shown.
With the fewest key strokes (shorter than --list and --list-all)
rbenv install -l
Want to see what is available from rbenv to install?
ruby-build --definitions
Want to narrow that down a bit?
ruby-build --definitions | grep 3.0
To upgrade to the latest rbenv and update ruby-build with newly released Ruby versions, upgrade the Homebrew packages:
brew update && brew upgrade rbenv ruby-build
Also you can always just type rbenv
Which will give you a help menu
rbenv
TLDR the manpage or github repo or just plain forgot?
Take a peek at this site for quick rbenv recollection:
https://devhints.io/rbenv
Also, you may need to brew upgrade if you have installed with brew see here.
I just installed ruby via
brew install ruby
I have been advised to install it via RVM, even if I use Homebrew, but first I want to uninstall the ruby that homebrew just installed.
Can I simply do
brew uninstall ruby
Or do I need to do something else?
Yes, brew uninstall ruby should do the trick.
For more info, you can type man brew in your terminal.
Doing brew uninstall ruby will work. If you really want to be sure, you can run brew cleanup after running the first command. Homebrew just removes unnecessary packages with the brew cleanup command. In some cases, the last command is necessary for the formula to be completely gone. (An example is with the tree formula, I had to use brew cleanup for it to be entirely uninstalled.)
(I know this is late but this can apply to anyone who is viewing this)
This might help other people who used rbenv to manage their ruby versions & have installed rbenv using the command below
brew install rbenv ruby-build
You can uninstall ruby by
brew uninstall rbenv && brew uninstall ruby-build
You can refer to the Installing Ruby section of this guide.
Here is what I have done so far.
Clean install of OS X Lion
Downloaded and installed latest version of Xcode from the App Store.
Installed Git
Installed Homebrew
Installed RVM
I am now trying to install Ruby Enterprise Edition for a project with rvm install ree and receive the following error:
$ rvm install ree
ree-1.8.7-2011.03 - #installing
ERROR: Error running './installer -a /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03
--no-tcmalloc --dont-install-useful-gems ', please read
/Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting
the installation.
I have already tried CC=/usr/bin/gcc-4.2 rvm install ree and with the same result.
I was able to duplicate your error, just now. This solved it for me:
$ rvm remove ree
$ export CC=/usr/bin/gcc-4.2
$ rvm install --force ree
Using MacPorts you can install Ruby Enterprise Edition, as well as Ruby 1.9.2 for the local user in OS X Lion while having Xcode 4.2 installed by using "Apple's version of gcc 4.2."
Prerequisites:
OS X Lion (tested in 10.7.2)
Xcode 4.2
rvm 1.9.1
MacPorts 2.0.3
Execute the following commands:
$ sudo port install apple-gcc42
$ export CC=/opt/local/bin/gcc-apple-42
then
$ rvm install ree
$ rvm use ree
or
$ rvm install 1.9.2
$ rvm use 1.9.2
optionally
$ rvm use ree --default
or
$ rvm use 1.9.2 --default
I hope this helps.
-Joe
No need to install MacPorts or downgrade to 4.1 to get GCC, I used the installer package at https://github.com/kennethreitz/osx-gcc-installer with xCode 4.2 already installed, and had no problem installing 1.9.2-head and 1.9.2-p290.
I did something similar to what jbg advised. Only I didn't use MacPorts. I just used the latest GCC package for Lion here.
This was after spending about a day and a half trying all of the other suggestions, downgrading to Xcode 4.1, etc. to no avail.
By the way, the direct link to Xcode 4.1 at Apple's site gave me an invalid checksum error, all three times I downloaded it. I saw a Twitter post from someone else who had the same problem.
At the risk of redundancy, I'll post my answer as well, since I tried everything on this page (and many others) and ended up with a hybrid of some of them which seemed the most likely to work. Note that some of these steps may not have been explicitly necessary but they were sufficient (i.e., I didn't go back and remove potentially unnecessary steps to get the simplest path to success).
Environment: Mac OS Lion 10.7.3, Homebrew components, rvm 1.10.2, ree 1.8.7-2012.01, Xcode 4.2.1 with legacy gcc-4.2 available.
Steps:
Ensure that a stable Ruby is current. Used 1.9.2 (rvm use 1.9.2) as 1.9.3 was a potential problem.
rm -fr $rvm_path/usr
rvm pkg install ree_dependencies
rvm remove ree
export CC=/usr/bin/gcc-4.2
rvm install ree \
--with-openssl-dir=$rvm_path/usr \
--with-readline-dir=$rvm_path/usr \
--with-iconv-dir=$rvm_path/usr \
--with-zlib-dir=$rvm_path/usr
I had previously tried the brew-specific solutions but those didn't work for me. Hope this helps someone!
Please do NOT use sudo with RVM, nor do you need to use rvmsudo EXCEPT for when upgrading RVM itself. Please see and read https://rvm.io/support/faq/ (Do I need to use sudo with gems? entry) and https://rvm.io/support/troubleshooting/ (Multi-User Installs - Using the sudo command entry)
Please remove your current installation and start over as using sudo will definitely mess up the permission structure for RVM. Please see the very bottom of https://rvm.io/support/troubleshooting/ (How do I completely clean out all traces of RVM from my system, including for system wide installs? entry)
Then begin again strictly following the Multi-User installation segment of https://rvm.io/rvm/install/
Thank you.
If you are on Lion 10.7.2, and have installed XCode 4.2, you need to downgrade XCode to 4.1
Here's how I did it (it was more complicated than you might think):
Download XCode 4.1 from Apple Dev Center (you'll need to login with your dev centre creds)
uninstall XCode 4.2
$ sudo /Developer/Library/uninstall-devtools --mode=all
remove the XCode installer from your /Applications directory
run the XCode 4.1 package you downloaded, this will install a new XCode installer into /Applications
run the XCode installer in /Applications
When it stops, asking you to quit iTunes, you need to quit iTunes, and also use Activity Monitor to force quit the iTunes Helper
Wait for XCode 4.1 to install
Use the steps outlined above to install ree
Cheers,
Ian
This is how i did to install it. May be previous answers are already solve your problem. My step may be help people who experience same as me.
Frist, Install MacPort latest version
>rvm uninstall ree
>sudo port install apple-gcc42
>export CC=/opt/local/bin/gcc-apple-4.2
>rvm pkg install zlib openssl readline
>rvm install --force ree
Result is:
IronB:~ ...$ rvm install --force ree
Installing Ruby Enterprise Edition from source to: /Users/.../.rvm/rubies/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #fetching (ruby-enterprise-1.8.7-2011.03)
ree-1.8.7-2011.03 - #extracting ruby-enterprise-1.8.7-2011.03 to /Users/.../.rvm/src/ree-1.8.7-2011.03
Applying patch 'tcmalloc' (located at /Users/.../.rvm/patches/ree/1.8.7/tcmalloc.patch)
Applying patch 'stdout-rouge-fix' (located at /Users/.../.rvm/patches/ree/1.8.7/stdout-rouge-fix.patch)
Applying patch 'no_sslv2' (located at /Users/.../.rvm/patches/ree/1.8.7/no_sslv2.diff)
ree-1.8.7-2011.03 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.10 for ree-1.8.7-2011.03 ...
Installation of rubygems completed successfully.
ree-1.8.7-2011.03 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ree-1.8.7-2011.03 - #importing default gemsets (/Users/.../.rvm/gemsets/)
I'm also put this to my ~/.rvmrc for next time
# Make this work with OS X Lion... for now...
if [[ `uname -v` =~ "Darwin Kernel Version 11" ]] ; then
export CC=/opt/local/bin/gcc-apple-4.2
fi