weewx 4 on mac

127 views
Skip to first unread message

Graham Eddy

unread,
Aug 28, 2019, 10:13:04 PM8/28/19
to weewx-de...@googlegroups.com
for weewx 4, i would like to request a couple of lines be added to the daemon config on mac osx, to cause stderr to be captured in a file (those lousy hidden exceptions).
this file is presently (3.9.2) made available under util/launchd/com.weewx.weewxd.plist.
i use the modified version below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.weewx.weewxd</string>
    <key>Disabled</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/weewx/bin/weewxd</string>
        <string>/opt/weewx/weewx.conf</string>
    </array>
    <key>StandardErrorPath</key>
    <string>/opt/weewx/var/run.stderr</string>
</dict>
</plist>

i also applaud the use of python’s logging package, given that syslog is completely useless on mac osx. i have been using logging package in my own python code for a while

cheers
____________
Graham Eddy

Thomas Keffer

unread,
Aug 29, 2019, 8:40:54 AM8/29/19
to Graham Eddy, weewx-development
I have no objection to something like this, but the path you've chosen (/opt/weewx/var/run.stderr) seems pretty specific to your system. I'm not a Mac expert. Is there a more generic location it could write to?

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/3F693679-8F07-416F-8B44-7270B374060B%40gmail.com.

Vince Skahan

unread,
Aug 29, 2019, 10:21:36 AM8/29/19
to weewx-development
On Thursday, August 29, 2019 at 5:40:54 AM UTC-7, Tom Keffer wrote:
I have no objection to something like this, but the path you've chosen (/opt/weewx/var/run.stderr) seems pretty specific to your system. I'm not a Mac expert. Is there a more generic location it could write to?



See if 'man hier' is available on current MacOS (sorry - can't check until I get home).

In general you 'probably' want to put your var stuff under /var/weewx to separate the read-mostly (/opt) stuff from the read-write (/var) stuff.

Chris Alemany

unread,
Aug 29, 2019, 11:09:47 AM8/29/19
to weewx-development
Yes 'man hier' is available under macOS 10.14.6

/opt is not an unusual place to put open source stuff on Mac, it is what wview used as well.  However, I would lean toward /var as well as Vince suggested or even put the logs within the user defined area (I have mine in /Users/Shared/weewx/logs) so it’s all in one place which has been nice from an accessibility standpoint.

Cheers
Chris

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.

Greg Troxel

unread,
Aug 29, 2019, 3:04:20 PM8/29/19
to Chris Alemany, weewx-development
Chris Alemany <chri...@gmail.com> writes:

> Yes 'man hier' is available under macOS 10.14.6
>
> /opt is not an unusual place to put open source stuff on Mac, it is
> what wview used as well. However, I would lean toward /var as well as
> Vince suggested or even put the logs within the user defined area (I
> have mine in /Users/Shared/weewx/logs) so it’s all in one place which
> has been nice from an accessibility standpoint.

This is messy. Often in hier (which is a BSD thing from way back),
there is a notion that it's talking about system files. For that, /var
is arguably right.

But, on mac you can't write into /usr (System Integrity Protection), and
really you shouldn't use --prefix=/usr, but something else. pkgsrc used
to use /usr/pkg, like on other systems, and is now /opt/pkg to avoid the
SIP restriction (avoid, not evade, as writing in /opt is an ok thing to
do - /usr/pkg would be ok too but is not allowed anyway).

Once you have a special prefix, then one can put things in ${PREFIX}/var
so it is logically associated.

I see your point about read-mostly vs rw, but if it's all on / anyway,
then I don't see that it matters much.

Thomas Keffer

unread,
Aug 29, 2019, 8:24:21 PM8/29/19
to weewx-development
I must be missing something, and I am most definitely not a Mac expert, but my laptop doesn't even have an /opt directory.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.

mwall

unread,
Aug 29, 2019, 10:02:57 PM8/29/19
to weewx-development
On Thursday, August 29, 2019 at 8:40:54 AM UTC-4, Tom Keffer wrote:
I have no objection to something like this, but the path you've chosen (/opt/weewx/var/run.stderr) seems pretty specific to your system. I'm not a Mac expert. Is there a more generic location it could write to?

why not use /home/weewx as the base directory so that the paths are /home/weewx/bin/weewxd, /home/weewx/weewx.conf, and /home/weewx/weewx.log

i think that is the convention we have used in other configuration files - assume a setup.py installation for any boilerplate files.  we do this on debian, redhat, and suse.  and the macos install guide is written for /home/weewx

any package installers or per-platform guides can then simply swap out the path, or provide the preferred paths/locations for the platform

m

Greg Troxel

unread,
Aug 30, 2019, 8:07:41 AM8/30/19
to Thomas Keffer, weewx-development
Thomas Keffer <tke...@gmail.com> writes:

> I must be missing something, and I am most definitely not a Mac expert, but
> my laptop doesn't even have an /opt directory.

It doesn't, and macs don't have /home by default either (mac uses
/Users/$USERNAME instead). But either /opt or /home can be created,
even with SIP on. /opt has more of a connotation of an installed
package and /home as more of a pseudouser.

But they are just strings, and mwall's comment about aligning the
default setup.py path to /home/weewx to match other platforms is
compelling.

Thomas Keffer

unread,
Sep 2, 2019, 10:36:26 AM9/2/19
to weewx-development
But they are just strings, and mwall's comment about aligning the
default setup.py path to /home/weewx to match other platforms is
compelling.

Except, unfortunately, on the Mac, /home is a mounted drive, so we would have to edit /etc/auto_master, unmount, then reboot. Not worth it.

Better to use $HOME.

-tk

mwall

unread,
Sep 2, 2019, 5:59:09 PM9/2/19
to weewx-development
and i mistyped.  the macos instructions put weewx in /Users/Shared/weewx (not /home/weewx)

so the file would be:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.weewx.weewxd</string>
    <key>Disabled</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/Shared/weewx/bin/weewxd</string>
        <string>/Users/Shared/weewx/weewx.conf</string>
    </array>
    <key>StandardErrorPath</key>
    <string>/Users/Shared/weewx/weewx.stderr</string>
</dict>
</plist>


Thomas Keffer

unread,
Sep 2, 2019, 6:48:27 PM9/2/19
to mwall, weewx-development
Seems like we've come to consensus. Good thing, because I know next to nothing about the Mac. Implemented in commit c6ff6ed.

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages