error: can't read "result": no such variable

Joshua Root jmr at
Sat Dec 2 03:01:36 UTC 2017

Did the selfupdate actually update macports base? Blowing away your
installation won't help in any case.

There is an error in the error handling, but that's only a problem
because there is an error when running sw_vers in the first place. I
just fixed it, so if you're comfortable applying this change to
/opt/local/libexec/macports/lib/macports1.0/macports.tcl that will let
you see the actual error:

Run e.g. 'port -d version' to see the relevant error message.

Alternatively you could try running this in your shell (all one line):

echo 'puts [exec /usr/bin/sw_vers -productVersion | cut -f1,2 -d.]' |

which may exhibit the same failure as macports is seeing.

- Josh

> It worked for me too until I did a self update sometime today.  Is there a way to fix this or should I just blow away the installation?
> -gideon
>> On Dec 1, 2017, at 5:12 PM, Craig Treleaven <ctreleaven at> wrote:
>>> On Dec 1, 2017, at 4:44 PM, Gideon Simpson <gideon.simpson at <mailto:gideon.simpson at>> wrote:
>>> I just started having the problem:
>>> gideon at mymachine:~$ port list outdated
>>> can't read "result": no such variable
>>>     while executing
>>> "ui_debug "sw_vers exists but running it failed: $result""
>>>     invoked from within
>>> "try -pass_signal {
>>>             set macosx_version [exec /usr/bin/sw_vers -productVersion | cut -f1,2 -d.]
>>>         } catch {*} {
>>>             ui_debug "..."
>>>     (procedure "mportinit" line 56)
>>>     invoked from within
>>> "mportinit ui_options global_options global_variations"
>>> Error: /opt/local/bin/port: Failed to initialize MacPorts, can't read "result": no such variable
>> Hmm, works for me.  However, is there some reason you want to use the ‘list’ verb?  Try using just ‘port outdated’.
>> Craig

More information about the macports-users mailing list