ruby_select is broken

Bill Cole macportsusers-20171215 at billmail.scconsult.com
Sun Oct 3 21:11:11 UTC 2021


On 2021-10-03 at 16:16:55 UTC-0400 (Mon, 4 Oct 2021 07:16:55 +1100)
Ian Wadham <iandw.au at gmail.com>
is rumored to have said:

> Hi Christopher,
>
> In brief, MacPorts’ “port select” command is working fine at the 
> command-line in Catalina… but the problem is with installing ANY 
> version of ruby, not switching between multiple versions of ruby that 
> are already installed.
>
> In a machine where no MacPorts Ruby is installed, the command “sudo 
> port install ruby27” is not working fully.

It is definitely working as designed. Your complaint is with the design.

>
> The package gets installed, but the links /opt/local/bin/ruby -> 
> /opt/local/bin/ruby2.7 and /opt/local/bin/gem -> /opt/local/bin/gem2.7 
> do not get created automatically.

Right. You MUST run 'port select ruby <instancename>' to select which 
binaries under /opt/local/*bin  the symlinks point to. That's how *ALL* 
*_select ports work: they create the generic-name links if you select 
one version, and remove them if you select the "none" option.

> So after installing I always get Apple’s Ruby from /usr/bin when I 
> use a “ruby” or “gem” command. Of course I can use “sudo 
> port select” to fix that, and I have done, but it took me several 
> days of frustration and messing around before I discovered that fact.

That's a documentation problem, I guess. FWIW, the information is 
present in ruby_select:

	# port info ruby_select
	ruby_select @1.2 (sysutils, lang)

	Description:          This port installs files that allow 'port select' 
to be used to create links to the preferred default version of Ruby.
	Homepage:             https://www.macports.org/

	Platforms:            darwin
	License:              BSD
	Maintainers:          Email: kimuraw at macports.org, GitHub: kimuraw
	                      Policy: openmaintainer

>
> I think this is because the port file named “ruby_select”, on 
> which each Ruby port depends, is broken.

But it is not broken.

The ruby_select port is what provides the information that 'port select' 
needs to make links to a specific set of Ruby binaries.



> You can see this port file’s contents using:
>
>      cat $(port file ruby_select)
>
> Compare them to the perl and python “select” files:
>
>      cat $(port file perl_select)
>      cat $(port file python_select)
>
> and I hope you (or someone) will see what the problem is.

There is no problem.

General rule: the *_select ports support the simultaneous installation 
of multiple versions of a port (mostly dev tools) with the active 
version being determined by use of 'port select' commands. Installing a 
specific version of a port that has a *_select port does not directly 
set the links to activate that version, you MUST use port select.



-- 
Bill Cole
bill at scconsult.com or billcole at apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


More information about the macports-users mailing list