Ruby 2.0.0 came out today and I thought I'd install it. I had been using rvm to handle my multiple versions of ruby, but when I tried to do a rvm install 2.0.0, I got a bunch of errors about homebrew. It seems as though homebrew is now required. This is a problem for me because I've been using MacPorts for years and I just don't feel like switching right now. So, I figured that I'd just see if I could compile it myself by hand and come up with a way to have multiple versions of ruby. The thing is, I really don't switch between versions all that much. I will now, as I slowly convert all the sites I have to 2.0. So I'll need to go back and forth a little. But once it's done, I probably won't switch for a long time. I've been on 1.9.3 for a very long time and it worked fine. Anyway, I'm not exactly sure how I'll do this, but I'm going to give it a try.
First step, was to update XCode and then go into Preferences and update the command-line tools. In the ruby download, my config command was pretty basic:
ant:ruby-2.0.0-p0 $ ./configure --prefix=/Users/maryh/Software/rubies/2.0.0-p0
Putting everything in a Software/rubies/version directory seems to be a good idea. I could be completely wrong about this, but that's how I'm starting. My first make attempt failed with an error like this:
compiling ./missing/setproctitle.c compiling dmyext.c linking miniruby /Users/maryh/Downloads/ruby-2.0.0-p0/lib/fileutils.rb:111: [BUG] Stack consistency error (sp: 38, bp: 36) ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0] -- Crash Report log information -------------------------------------------- ...
I needed to set CC=clang (it was CC=gcc-4.2) and that fixed this problem.
compiling readline.c readline.c:1688:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'? rl_username_completion_function); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rl_username_completion_function readline.c:75:42: note: expanded from macro 'rl_username_completion_function' # define rl_username_completion_function username_completion_function ^ /usr/local/include/readline/readline.h:449:14: note: 'rl_username_completion_function' declared here extern char *rl_username_completion_function PARAMS((const char *, int)); ^ 1 error generated.
Readline errors are apparently common. Again, I'm pretty sure this is related to the fact that I'm using MacPorts. My fix was to:
ant:ruby-2.0.0-p0 $ export LDFLAGS="-L/opt/local/lib"
Then rerun configure and make and things worked. Everything is installed in /Users/maryh/Software/rubies/2.0.0-p0. And the gem environment is:
ant:bin $ ./gem env RubyGems Environment: - RUBYGEMS VERSION: 2.0.0 - RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [x86_64-darwin12.2.0] - INSTALLATION DIRECTORY: /Users/maryh/Software/rubies/2.0.0-p0/lib/ruby/gems/2.0.0 - RUBY EXECUTABLE: /Users/maryh/Software/rubies/2.0.0-p0/bin/ruby - EXECUTABLE DIRECTORY: /Users/maryh/Software/rubies/2.0.0-p0/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-12 - GEM PATHS: - /Users/maryh/Software/rubies/2.0.0-p0/lib/ruby/gems/2.0.0 - /Users/maryh/.gem/ruby/2.0.0 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/
So, now I think I can just install gems there and see how things go.