How to get a developers' package for Ruby

Ian Wadham iandw.au at gmail.com
Sun Sep 26 03:14:15 UTC 2021


Hi Jose and thank you for your reply.

> On 22 Sep 2021, at 3:05 pm, Jose Hales-Garcia <jolohaga at me.com> wrote:
> Hi,
> You might see if Rbenv would work for you in this case.
> https://github.com/rbenv/rbenv
> 
> I googled and there are folks who’ve gotten cocoapods working with rbenv installed Ruby versions.

I did some googling around before starting this thread, but I have done some more googling around now and also some digging deeper into MacPorts.

I have found that I can get any of several versions of Ruby and its development tools (gem, etc) from MacPorts, so I won’t be needing rbenv at the moment, nor any of the other Ruby installers such as RVM or Homebrew's ruby-dev.

The trac tickets for CocoaPods and discussions in CocoaPods' StackOverflow area gave me some leads. It turns out that the deprecation warning in Apple’s Release Notes for Catalina, regarding Ruby, Python and Perl, was a red herring for me, although it is true that Apple will withdraw runtime support for those languages eventually. See https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes.

The real problem I have been fighting all along is simply that the version of Ruby and its development tools in Catalina is too old to build the current version of CocoaPods and also that my build failed with a whole lot of unreadable diagnostics. Not good for a “Getting Started” situation...

It also did not help that MacPorts' “ruby_select” port is broken, so I was previously unable to find a “gem” executable in MacPorts’ “rubyNN” packages, which depend on "ruby_select". I got around that when I ran across the “port select” command and used it to form the needed links to “ruby”. “gem”, etc.

Anyway, I have now used MacPorts’ Ruby to build CocoaPods and satisfy the Flutter package’s dependencies in a MacOS environment.

And I can now answer my own questions (see below if interested).

> Jose
> 
>> On Sep 21, 2021, at 9:49 PM, Ian Wadham <iandw.au at gmail.com> wrote:
>> 
>> I wish to download from the Web a package called CocoaPods, however it needs a developers’ package of Ruby to build it.
>> 
>> I am using MacOS Catalina 10.15.7. Apple provides Ruby in this MacOSversion, but will not allow it to be used for building non-Apple apps. They say they are phasing out the use of Ruby in MacOS and Apple Mac apps.

Apple’s Ruby in Catalina does still have runtime support, but Ruby, Python and Perl will disappear from MacOS eventually.
See https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes

>> 
>> Googling around about this problem, all the solutions I have found recommend getting a "ruby-dev" package from Homebrew, but MacPorts, which I use a lot, recommends against mixing MacPorts and Homebrew.
>> 
>> Apple’s version of Ruby is ruby 2.6.3p62 (2019-04-16 revision 67580).

This is too old to build the current version of CocoaPads, but I have been able to build it using MacPorts “ruby27” and a manual “port select” command.

>> MacPorts has a package ruby @1.8.7-p374_12 (lang, ruby), but also packages ruby26 @2.6.8_1 (lang, ruby), ruby27 @2.7.4_1 (lang, ruby), etc. Are all of these development versions, or just runtime versions? If MacPorts has a development version of Ruby, which would be the best version to use to build CocoaPods?

All Macports’ “rubyNN” packages can be used for development and runtime AFAICS, but “ruby_select” is broken and you need to use “port select” manually.

>> Failing that, would it be safe to install Homebrew and its ruby-dev, just for building CocoaPods?

No need, but MacPorts’ “ruby_select” needs fixing, to work similarly to “python_select” and “perl_select”.

Cheers,
Ian Wadham.



More information about the macports-users mailing list