In general, I would like to know if there are any discrepancies between the MacPorts coreutils and the GNU coreutils, and how I might go about answering this question myself. In particular, I don't understand why the su command (or the gsu command, since all of the MacPorts coreutils applications also seem to come prefixed with a 'g') doesn't seem to be included by MacPorts.

First, I check that I have the coreutils package installed:

$ port installed coreutils
The following ports are currently installed:
  coreutils @8.22_0 (active)

$ port info coreutils
coreutils @8.22 (sysutils)
Variants:             universal

Description:          The GNU Core Utilities are the basic file, shell, and text manipulation utilities of the GNU operating
                      system. These are the core utilities which are expected to exist on every operating system. Previously
                      these utilities were offered as three individual sets of GNU utilities, fileutils, shellutils, and
                      textutils. Those three have been combined into a single set of utilities called the coreutils.
Homepage:             http://www.gnu.org/software/coreutils/


So far so good. Then I look for instances of su and gsu on my path:

$ which -a su gsu; 

Nothing; the GNU su isn't there. As a sanity check, I look for some other coreutils applications, e.g. rm:

which -a rm grm

It looks like the directories to check are /opt/local/bin and /opt/local/libexec/gnubin, so I look there:

$ ls -1 /opt/local/bin /opt/local/libexec/gnubin | grep -x 'su\|gsu'

Again, nothing. Now, this is almost certainly redundant, but I also try looking with the port contents command:

$ port contents coreutils | grep -x ".*su"

Nothing. Am I certain that su is included in GNU coreutils? No, I guess not. So I check here:


It looks like it is; it's listed under the Shell Utililites header. So what gives?


su has moved from coreutils to the utils-linux project since v8.18, since it's more aligned with the linux specific routines in PAM etc. http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=928dd737

For more portable and light weight switching of user credentials, one can use gchroot --user=... /

I've amended wikipedia appropriately

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .