Skip to content

Running on macOS

Jef LeCompte edited this page Jul 20, 2025 · 1 revision

Here’s a quick guide for installing Node.js on macOS and setting up a daily scheduled task to run your zap2xml script with the required arguments:

  1. Installing Node.js

    1. Open Terminal.
    2. Install Homebrew if you don’t have it:
      /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    3. Install Node.js (LTS version) using Homebrew:
      brew install node
    4. Verify installation:
      node -v
      npm -v
  2. Install zap2xml dependencies and build

In Terminal, run:

cd /path/to/zap2xml
npm install
npm run build
  1. Create a shell script to run zap2xml

Create a file named run-zap2xml.sh in your zap2xml folder with the following content (edit the arguments as needed):

#!/bin/bash
cd /path/to/zap2xml
node dist/index.js --lineupId=YOUR_LINEUP_ID --timespan=15 --country=USA --postalCode=12345

Replace YOUR_LINEUP_ID, 15, USA, and 12345 with your actual values.

Make the script executable:

chmod +x run-zap2xml.sh
  1. Schedule a daily task using launchd
    1. Create a property list file at ~/Library/LaunchAgents/com.zap2xml.daily.plist with the following content (update the path as needed):
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
          <key>Label</key>
          <string>com.zap2xml.daily</string>
          <key>ProgramArguments</key>
          <array>
              <string>/path/to/zap2xml/run-zap2xml.sh</string>
          </array>
          <key>StartCalendarInterval</key>
          <dict>
              <key>Hour</key>
              <integer>2</integer>
              <key>Minute</key>
              <integer>0</integer>
          </dict>
          <key>StandardOutPath</key>
          <string>/tmp/zap2xml.log</string>
          <key>StandardErrorPath</key>
          <string>/tmp/zap2xml.err</string>
      </dict>
      </plist>
    2. Load the job:
      launchctl load ~/Library/LaunchAgents/com.zap2xml.daily.plist
    3. The script will now run daily at 2:00 AM. Adjust the time in the plist as needed.

This will run your zap2xml script once a day with your specified arguments on your macOS machine.

Clone this wiki locally