MacPorts under Launchd (Snow Leopard)

Arno Hautala arno at
Mon Nov 23 20:50:07 PST 2009

I have a script which updates MacPorts and then upgrades any outdated
ports.  Under 10.5 I had this running weekly via launchd.  Now under
10.6 I'm getting errors related to the HOME environment variable.  The
same script completes successfully when run with sudo on the command
I did find a similar problem mentioned in 2007 with a resolution, but
it appears that something has changed in 10.6.  Or could this be an
issue with my install?  I'm seeing the same issue on both of my 10.6
machines.  I did begin my SL migration by wiping away /opt and

The 2007 thread:
The referenced revision:

Thanks for your help,


The full error from running "/opt/local/bin/port selfupdate" is below

couldn't find HOME environment variable to expand path
    while executing
"file normalize $px"
    (procedure "::tcl::tm::roots" line 7)
    invoked from within
"::tcl::tm::roots {~/Library/Tcl /Library/Tcl /System/Library/Tcl} "
    invoked from within
"if {![interp issafe]} { ::tcl::tm::roots {~/Library/Tcl /Library/Tcl
/System/Library/Tcl} }"
    (file "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tm.tcl"
line 381)
    invoked from within
"source /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tm.tcl"
    (in namespace eval "::" script line 1)
    invoked from within
"namespace eval :: $auto_index($name)"
    (procedure "auto_load" line 35)
    invoked from within
"auto_load $name [uplevel 1 {::namespace current}]"
    (autoloading "::tcl::tm::UnknownHandler")
    (procedure "::unknown" line 30)
    invoked from within
"::tcl::tm::UnknownHandler  {::tcl::MacOSXPkgUnknown ::tclPkgUnknown} msgcat 0-"
    ("package unknown" script)
    invoked from within
"package require msgcat"
    (file "/opt/local/share/macports/Tcl/registry1.0/registry.tcl" line 39)
    invoked from within
"source /opt/local/share/macports/Tcl/registry1.0/registry.tcl"
    ("package ifneeded registry 1.0" script)
    invoked from within
"package require registry 1.0"
    (procedure "mportinit" line 424)
    invoked from within
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, couldn't
find HOME environment variable to expand path

arno  s  hautala    /-\   arno at

pgp eabb6fe6 d47c500f b2458f5d a7cc7abb f81c4e00

More information about the macports-users mailing list