Helix Startup Script Adapted for macOS 11

Overview

This Bash script initializes a Helix environment and launches lighttpd and helixd, adapted for macOS 11.

Key Adaptations

Script

#!/bin/bash

set -e

# Get script directory path
realpath="$(cd "$(dirname "$0")"; pwd -P)"
cd "$realpath"

# Set up Helix config
datadir="$HOME/Library/Application Support/Helix"
rpcpassword="$(tr -dc A-Za-z0-9_ < /dev/random | head -c 32 | xargs)"

echo "rpcpassword=$rpcpassword" > helix.conf
mkdir -p "$datadir"
cp helix.conf "$datadir"/

echo "rpcpassword = \\"$rpcpassword\\"" > helixrpc.py
mkdir -p var/www/cgi-bin
cp helixrpc.py var/www/cgi-bin/

# Update lighttpd config paths
sed -i '' "s|/opt/homebrew|$realpath|" etc/lighttpd/lighttpd.conf
sed -i '' "s|/opt/homebrew|$realpath|" etc/lighttpd/lighttpd.annotated.conf

# Launch services
sbin/lighttpd -f etc/lighttpd/lighttpd.conf -m lib
./helixd

Notes