MacPorts under Launchd (Snow Leopard)

Arno Hautala arno at alum.wpi.edu
Thu May 27 20:30:56 PDT 2010


For the benefit of those who search on this topic in the future:

I was contacted recently by someone who was experiencing the same
issue as is referenced below.  MacPorts, when run by launchd complains
about a missing HOME environment variable.  I let the user know that I
hadn't attempted to solve the problem and they responded by finding a
solution.

The launchd task simply needs to have an entry for the relevant
environment added to the plist.  In my case, I'm now using the
following:
    <key>EnvironmentVariables</key>
    <dict>
        <key>HOME</key>
        <string>/var/root</string>
    </dict>

It doesn't appear that MacPorts actually writes anything to /var/root,
aside from creating a .macports directory.

In any event, hopefully this helps someone else looking for the same solution.

--Arno



On Tue, Nov 24, 2009 at 00:50, Arno Hautala <arno at alum.wpi.edu> wrote:
> 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
> line.
> 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
> reinstalling.
>
> The 2007 thread:
> http://lists.macosforge.org/pipermail/macports-dev/2007-May/001721.html
> The referenced revision: http://trac.macports.org/changeset/25177
>
> Thanks for your help,
>
> --Arno
>
> 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 alum.wpi.edu
>
> pgp eabb6fe6 d47c500f b2458f5d a7cc7abb f81c4e00
>



-- 
arno  s  hautala    /-|   arno at alum.wpi.edu

pgp eabb6fe6 d47c500f b2458f5d a7cc7abb f81c4e00


More information about the macports-users mailing list