Having Trouble Installing Ruby with RVM - xcode

I'm trying to install Ruby-1.9.2-head on a Mac running OS X 10.6.8 and Xcode 3.2.5. Whenever I run the command "rvm install ruby-1.9.2-head", I get an error during the "#configuring" part. The configure.log file says:
./configure --prefix=/Users/me/.rvm/rubies/ruby-1.9.2-head --enable-shared --disable-install-doc --with-libyaml-dir=/Users/me/.rvm/usr
configure: error: cannot run /bin/sh tool/config.sub
I've tried completely removing rvm and then re-installing the stable version (1.10.0) according to the instructions on Wayne's RVM homepage to no avail. Also, I do already have the 1.8.7 version of Ruby (which came with the machine) still installed.
I was successful in installing rvm and Ruby on two other machines that are also running OS X 10.6.8 but they were running Xcode 3.2.6. Do I perhaps need to upgrade Xcode?
Thanks.

rvm notessays you just need Xcode Tools Version 3.2.1 (1613) or later to install rvm.
I can remember I had to install the latest XCode version since my Lion upgrade to install ruby 1.9.2. Although you running OS X 10.6.8 and not Lion, there should be a new XCode version for you to download.

Related

Getting hard time installing Ruby on mac

I am trying to install Ruby on my mac and that too the latest version but having trouble.
The pre-installed ruby on mac is of verion 2.0 however, I need to upgrade the same to latest.
I tried installing ruby with Homebrew like brew install ruby but whenever i check the version, it shows me the earlier version only. Refer Terminal screenshot:
Am trying to learn ruby but this thing got me stuck for long.
Have also tried another package manager rbenv and did rbenv install 2.5.1 but that failed with the following error I have no idea about
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/vshukla/.rbenv/versions/2.5.1
--with-openssl-dir=/usr/local/opt/openssl
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/vshukla/.rbenv/versions/2.5.1/lib
CPPFLAGS=-I/Users/vshukla/.rbenv/versions/2.5.1/include
Please guide.
Homebrew has correctly installed the last version of ruby in /usr/local/bin. You can check it with:
/usr/local/bin/ruby --version
The macOS version of ruby is installed in /usr/bin. You can check it with:
/usr/bin/ruby --version
If you want to always run the Homebrew versions of installed tools, you have to put /use/local/bin before /usr/bin in your PATH environment variable. You can do this by adding the following line in your ~/.bash_profile:
export PATH="/usr/local/bin:$PATH"
P.S.: According to your macos ruby version, you don't have the last macOS version.
The compile error log contains:
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try installing "zlib" and then try again, by running:
brew install zlib

Getting Ruby 1.8.7 installed on Mountain Lion (10.8)

I'm having a lot of trouble getting Ruby 1.8.7 installed on my clean install of Mountain Lion. I've looked around on Stack Overflow and don't see anything that specifically addresses this issue and hope that someone might have encountered this before.
I'm using the command line tools that can be downloaded with Xcode
I haven't had any problems installing Ruby 1.9.3 via RVM and HomeBrew. When I try to install 1.8.7 I get the following message after it tries to compile:
I first ran the command
rvm install 1.8.7
This gave me this error
The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
After digging around a bit I tried
rvm install 1.8.7 --with-gcc=clang
Error running 'make ', please read /Users/paulzaich/.rvm/log/ruby-1.8.7-p370/make.log
There has been an error while running make. Halting the installation.
Ruby 'ruby-1.8.7-p370' was built using clang - but it's not (fully) supported, expect errors.
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
At this point I did some more searching and found something about needing compile my own readline. RVM Does Not Install Ruby 1.9.2 on Snow Leopard: 'Error running 'make '
This unfortunately seemed to corrupt my entire rvm install including 1.9.3. I tried to reinstall 1.9.3 and got the same errors I as I was getting with 1.8.7. I completely deleted RVM at this point and reinstalled. Had no problem installing 1.9.3 again.
I also tried updating all versions of rvm based off of this post RVM issue with Mountain Lion. No luck there either.
Update: I also tried using this walkthrough for REE 1.8.7 which recommended installing gcc-4.2. No luck unfortunately.
Update 2: I reference rvm requirements and installed the following packages
brew update
brew tap homebrew/dupes
brew install autoconf automake apple-gcc42
rvm pkg install openssl
So far so good. Then I referenced this post on needing to reference the GCC compiler. I determined that the links referenced might not be correct because I'm using homebrew? I found the compiler in my Cellar folder and used the following command
CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 rvm install 1.8.7
No luck. Same error messages as before.
I just figured it out! Please reference this question on SO
rvm can no longer install 1.8.7-p352 on Mac OS X Mountain Lion
rvm reinstall 1.8.7 --without-tcl --without-tk
Alternatively, try this installation order if you have Homebrew.
brew install tcl-tk
rvm reinstall 1.8.7
Just to follow up to Paul's post. I'm running OSX 10.8.2, had 1.9.3 install without issues, but 1.8.7-p370 also failed. I symlinked gcc-4.2:
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
...successfully ran:
brew install tcl
...but tk failed:
brewk install tk
If you're in the same spot, this command did the trick:
CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.8.7 --without-tk
Latest Xcode provides only clang - not GNU gcc, you need to install gcc-4.2 to be able to compile Ruby 1.8.7 properly, following command will show available options:
rvm requirements
currently only ruby 1.9.3-p125 and later has limited support for clang, but this is limited support, and still errors can be found.

Why am I having trouble compiling Ruby 1.9.2 with RVM on Mac OS Lion?

I am having trouble installing Ruby 1.9.2 with rvm on Mac OS Lion.
It gets stuck in the compilation stage; I don't see any errors or output, but it will be stuck at the compilation message for hours upon hours. The miniruby process is still running and using quite a bit of CPU, but it just never finishes.
The only thing I can find in the logs is this message in the make.log:
<internal:prelude>:1: [BUG] Segmentation fault
Any ideas how I can get this to compile?
What version of xcode are you using?
rvm requirements has this little tidbit:
** Lion Users: Xcode Version 4.2.x for OS X Lion works only for ruby 1.9.3-p0 (or higher).
It currently fails to build several other rubies and gems, as well as several Homebrew and
Macports packages. Xcode Version 4.1 (4B110) works.
Xcode v4.1 is at: https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.1_for_lion/xcode_4.1_for_lion.dmg
It's also important to make sure your RVM is current. Run rvm get head to upgrade to the latest version.
It may be related to Lion trying to use llvm to compile instead of gcc. Try running the command like this CC=/usr/bin/gcc-4.2 rvm install 1.9.2 to use gcc.
Based on the information in this other answer: Why can't I install Rails on Lion using RVM?
First read the installation notes of rvm, Follow the link which helped me RVM on Mac

The RVM is not working for me

I'm trying to use RVM to install ruby 1.9.2 on a Lion system with xcode 4.2. I'm new to ruby so I don't understand why this is not working. I'm reading Ruby on Rails 3 Tutorial as my install guide. However, book is not up to date as it relates to Lion. Can anyone point out what's going on and give exact instructions on what I need to do?
If you do a fresh install of Xcode 4.2, it does not come with GCC (it only comes with LLVM GCC). You should download: https://github.com/kennethreitz/osx-gcc-installer to get GCC.
Once Xcode is installed:
Install RVM (http://beginrescueend.com/rvm/install/)
Close terminal, open a new terminal (just in case).
Enter: rvm list known
You can install any of the rubys with: rvm install X (where X is the ruby)
If you're not sure about step 4, just do "rvm install ruby-1.9.2"
I think that'll work...
I don't have that book, but try following the official instructions: http://beginrescueend.com/rvm/install
EDIT: Tried to leave this as a comment to Ngan, but don't know how to format in comments. If that is indeed the issue (you'll know because you will be getting segfaults when you install gems), Xcode still comes with plain gcc, it just uses LLVM GCC by default. You can set the environment variable CC to use plain gcc:
rvm remove 1.8.7 # or whatever version is failing, just in case
CC=/usr/bin/gcc-4.2 rvm install 1.8.7
If you don't mind using homebrew, try this instructions: Installing Rails on OS X Lion with HomeBrew, RVM and Mysql

sqlite3 gem on Mac OS X Lion... fail!

I just upgraded my Mac to Lion but unfortunately I had to re-setup my Rails development environment. With the following versions of software:
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
Rails 3.0.9
sqlite3 3.7.5
When I run the command:
sudo gem install sqlite3
It throws following exception:
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb
can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
And the it adds:
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
Did anyone dive into Lion yet..
Thanks
I was having problems with this. I downloaded the Xcode from Apps store and it still didn't work. I reinstalled Xcode 3.2 and still nothing. Then I read a post that said that downloading Xcode and installing it were different. I went the Applications and ran the Xcode installer and after that everything worked fine.
I had this problem too and realised installing XCode is not enough, following installation you need to go into XCode -> Preferences -> Download, and install the Command Line Tools. This installs GCC.
I've always had problems with OS X's built in Ruby. Use RVM. Helps Ruby devs manage their Ruby versions and libraries. Definitely recommended. Then from there, install your gems.
Install Guide: http://beginrescueend.com/rvm/install/
Edit: You won't even need to sudo anymore since everything is in your home directory hidden.
Installing Xcode didn't do the trick for me. Instead, I installed Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
Then installed sqlite with Homebrew:
brew install sqlite
And then finally ran:
sudo bundle install
within my Rails app, which successfully installed Sqlite
updated Xcode for Mac OS X Lion and sqlite3 gem installed without any trouble... So I think whenever anyone upgrades their Mac OS, the first thing they should do is update Xcode after the upgrade...
If upgrading to Lion, the first thing I would recommend is downloading and INSTALLING the new Xcode (4.2) from the Apple website. I know this is in regards to rails, but I like having Xcode for messing with Iphone and Ipad applications (granted I'm not very good at it...yet).
Then, you will want to download the GCC installer:
github.com/kennethreitz/osx-gcc-installer/downloads. Download the latest one.
This is somewhat of a replacement for Xcode and it will tell you that you can uninstall Xcode after this install is finished. That's up to you: I did not uninstall Xcode afterwards.
To test it out if it made an impact, I created a rails new appname in my terminal. The bundle worked fine, before it did not. There was an issue with gem install json -v '1.6.5'
Fwiw I'm currently in Chapter 9 of the Hartl tutorial and was working in rails 3.1, Snow Leopard OS X Before today.
Hope this helps!
I just upgraded to Maverick and had trouble with a few gems.
Go to Apple Developer Downloads and pickup Command Line Tools (OSX Mavericks) for Xcode.
After installation, I was able to bundle sqlite3 and pg gems.
For those still having issues installing sqlite3 gem in Mavericks:
sudo xcode-select --reset
xcode-select manual says, the reset option
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism.
By the way, this happened to me while migrating from Snow Leopard to Mavericks. I think the issue was with the developers tool path, which is different in each of these operating systems.

Resources