Read my latest article: Launching Rails projects, an open call for lessons learned (posted Tue, 23 Jun 2009 17:33:00 GMT)

Ruby 1.8.7 on MacPorts causing some problems

Posted by Robby Russell Fri, 20 Jun 2008 21:11:00 GMT

21 comments Latest by Sebastian Wed, 17 Jun 2009 23:23:37 GMT

It appears that MacPorts has upgraded to Ruby 1.8.7, which is good news if you’re running Rails 2.1… but if you have an older Rails application… it’s not going to work too well.

In order to get Ruby 1.8.6 installed with the latest MacPorts, you’ll need to do the following.


  $ mkdir /Users/Shared/dports

$ svn checkout -r 36429 \ 
    http://svn.macports.org/repository/macports/trunk/dports/lang/ruby/ \ 
    /Users/Shared/dports/lang/ruby/

Then you’ll need to modify your macports to use this new local source. You’ll need to edit /opt/local/etc/macports/sources.conf and add the following line above the existing rsync record.

file:///Users/Shared/dports and create that directory

Next, you’ll want to index this new local source with the following command:

portindex /Users/Shared/dports

After that, you can do the following.

sudo port uninstall rb-rubygems ruby

sudo port clean rb-rubygems ruby

sudo rm -r /opt/local/lib/ruby/gems/1.8/doc/rubygems-1.1.1/

sudo port deactivate autoconf

sudo port install ruby rb-rubygems

..and hopefully you’ll have Ruby 1.8.6 installed and be able to retain the rubygems you installed already.

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    david Sat, 21 Jun 2008 06:58:49 GMT

    I dealt with the same problem on debian. Here is my little how to for debian users:

    http://dev.hubiquity.fr/2008/6/3/avoid-rails-troubles-with-ruby-1-8-7-under-debian

    david

  2. Avatar
    Evan Sun, 22 Jun 2008 20:43:46 GMT

    Use this Portfile http://pastie.org/220010 to get Ruby 1.8.6-p230.

  3. Avatar
    Preston Lee Fri, 27 Jun 2008 20:01:39 GMT

    Thanks for the note. We have some small Rails 2.0.x projects which seem to be working fine on Ruby 1.8.7, but there’s definitely some bustedness going on with TestUnit. Exceptions… everywhere :(

  4. Avatar
    Ric Tue, 01 Jul 2008 19:22:49 GMT

    Thanks. I ended up giving up on Macports due to the problems with Ruby 1.8.7.

    Btw, Robby, is something up with your feed? In Newsfire (my RSS reader), I get nothing, and sometimes when I go to your feed url, no posts are shown.

  5. Avatar
    Hodinky Tue, 15 Jul 2008 10:31:40 GMT

    I ended up too, thank you!

  6. Avatar
    2tamad Tue, 22 Jul 2008 00:38:09 GMT

    me too

  7. Avatar
    roop Sat, 26 Jul 2008 07:05:07 GMT

    Fantastic—these instructions worked like a charm.

  8. Avatar
    The Copyrighter Wed, 20 Aug 2008 03:06:59 GMT
  9. Avatar
    Chip Castle Tue, 16 Sep 2008 20:07:36 GMT

    This is exactly what I am looking for today, but I am running into a fetch problem on OS X 10.4.11:

    chip-castles-powerbook-g4-17:/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/ruby deploy$ sudo port install rb-rubygems ruby -> Fetching ruby -> Attempting to fetch ruby-1.8.6-p114.tar.gz from http://www.ibiblio.org/pub/languages/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from http://mirrors.sunsite.dk/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://xyz.lcs.mit.edu/pub/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.iij.ad.jp/pub/lang/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.ruby-lang.org/pub/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.fu-berlin.de/unix/languages/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.easynet.be/ruby/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.ntua.gr/pub/lang/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.chg.ru/pub/lang/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.kr.FreeBSD.org/pub/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from ftp://ftp.iDaemons.org/pub/mirror/ftp.ruby-lang.org/ruby/1.8 -> Attempting to fetch ruby-1.8.6-p114.tar.gz from http://svn.macports.org/repository/macports/distfiles/ruby -> Attempting to fetch ruby-1.8.6-p114.tar.gz from http://svn.macports.org/repository/macports/distfiles/general/ -> Attempting to fetch ruby-1.8.6-p114.tar.gz from http://svn.macports.org/repository/macports/downloads/ruby Error: Target org.macports.fetch returned: fetch failed Error: The following dependencies failed to build: ruby Error: Status 1 encountered during processing.

    Any suggestions for fixing this fetch issue?

    Thanks!

  10. Avatar
    gourmet food Fri, 03 Oct 2008 16:06:59 GMT
    not sure it works here… it gives me the following warning:
    Warning: /opt/local/etc/macports/sources.conf specifies invalid source 'file:///Users/Shared/dports and create that directory', ignored.
    
    just started it with the following command:
     sudo port install ruby@1.8.6-p114 rb-rubygems rb-termios rb-mysql swig
    

    because without the @ it tried to install 1.8.7 anyway

  11. Avatar
    gourmet food Fri, 03 Oct 2008 16:31:26 GMT

    I did not work in the end. But I know why: not enough coffee!

    I copied all the line “file:///Users/Shared/dports and create that directory”

    You should at a line break to your instructions my friend.

    sudo port install ruby  rb-rubygems rb-termios rb-mysql swig
    --->  Fetching ruby
    --->  Attempting to fetch ruby-1.8.6-p114.tar.gz from http://www.ibiblio.org/pub/languages/ruby/1.8
    [...]
    

    thanks!

  12. Avatar
    Jaime Iniesta Sun, 02 Nov 2008 13:51:58 GMT

    Hey, I had some weirdness on rails since upgrading my Ubuntu to 8.10 as well…

  13. Avatar
    Matthew Fallshaw Mon, 10 Nov 2008 00:58:21 GMT
    Then…
    sudo port activate autoconf
    
    ?
  14. Avatar
    Zaphod Beeblebrox Mon, 08 Dec 2008 14:44:32 GMT

    I followed the procedure step by step, rigorously and several times, but MacPorts seems ignored the portfile in /Users/Shared/dports and install tirelessly ruby 1.8.7-p72_2+thread_hooks …

    I’m exhausted :-(

  15. Avatar
    Zaphod Beeblebrox Mon, 08 Dec 2008 16:11:07 GMT

    Arrgh !!!

    I add my dports directory below rsync line and no above …

    @Matthew Fallshaw good remark.

  16. Avatar
    Andrew Selder Wed, 11 Feb 2009 20:05:09 GMT

    This worked wonderfully. Now we’re moving to Ruby 1.8.7 and Rails 2.2.2

    How do I undo this so I can get back to the default package?

  17. Avatar
    louiss Thu, 19 Feb 2009 11:26:38 GMT

    maybe anybody can help me here

    i have installed ruby 1.8.7 with macport and after installtaion i update hte rubygems and installed rails mongrel rmagick and mysql .. now i create a rails app .. it work but when i want start it .. the terminal tell me : rubygems ? what… i reinstall rubygems ( i download it install it again and now the terminal tell me by starting the application i should install rails2.2.2 ! what is here wrong?

    i could start later my application but i had to reinstall all gems again. rails mongrel rmagick and mysql

    Is my installtion wrong or is these normal..

  18. Avatar
    Giles Bowkett Mon, 27 Apr 2009 00:48:29 GMT

    This is awesome, but how do I find out which revision number I need for my desired patchlevel? The current rev on svn.macports.org is 50160, I need patchlevel 287, which as far as I can tell is somewhere between your 36429 and macports’ insane 50160. IIRC svn uses a global commit number, so that 15K-commit distance may or may not even cover any real territory.

  19. Avatar
    Giles Bowkett Mon, 27 Apr 2009 00:50:50 GMT

    Ugh, you have to go here:

    http://trac.macports.org/log/trunk/dports/lang/ruby/Portfile

    Where you will discover they jumped straight from 1.8.6 p114 to 1.8.7.

    I don’t see the sense in that, but they must have had some kind of reason. Anyway thanks – I’ll use this to fix my install.

  20. Avatar
    Sofien Mahjoub Fri, 08 May 2009 08:57:19 GMT

    i have ruby version 1.8.6 and rails 2.2.2 .i need to run my app with mysql or postgrisql but I can’t i have a problem with gem mysql i tried your solution but not less…

    mac os tiger (sys) someone have any ideas because i need a help .thx

  21. Avatar
    Sebastian Wed, 17 Jun 2009 23:23:37 GMT

    Not sure when this happened, but you can now do “port install ruby186”

Share your thoughts... (really...I want to hear them)

Comments