Operations

Mac

macOS admin: Homebrew toolchains, Internet Sharing ranges, interface aliases, pf.conf.

4 tasks

This page is a scrubbed, public-safe version of an internal AI/SI operations runbook — the command cheat-sheet a systems engineer builds up over years of running Linux servers, virtualisation hosts, firewalls, databases, certificates and Raspberry Pi devices.

It is organised into the same sections as the original workbook, one page each — reach any of them from the AI/SI Prompts menu above. Every task on this page shows three things:

The point of the AI-prompt column is to show how a pile of accumulated tribal knowledge can be turned into something an assistant can reproduce and improve on demand: you keep the intent, and let the model rewrite the mechanics for whatever host you are on today. Nothing on this page should be run without reading it first — several snippets are destructive (dd, rm -rf, postsuper -d ALL, firewall reloads).

Installing dejavu for Python

Installs the OS packages and language libraries this component needs (apt/yum/brew plus pip/npm), on Raspberry Pi OS, CentOS or macOS.

Commands
brew install portaudio
brew install ffmpeg
sudo pip3 install pyaudio
sudo easy_install pydub
sudo easy_install numpy
sudo easy_install scipy
sudo easy_install matplotlib
Download the latest mysql-connector-python from mysql.com
AI prompt

Generate a Bash script for the task “Installing dejavu for Python”. Take the package list and package manager; run a single non-interactive install, then print the installed versions of the key tools. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.

Change default Internet Sharing IP addresses and range

Changes the address range macOS Internet Sharing hands out by writing the NAT start, end and mask keys with defaults write.

Commands
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart <INTERNAL_IP>
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberEnd <INTERNAL_IP>
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkMask <IP>
AI prompt

Generate a Bash script for the task “Change default Internet Sharing IP addresses and range”. Parameterise the start address, end address and mask; write them to com.apple.nat with sudo defaults write, print the resulting NAT dictionary, and note that Internet Sharing must be turned off and on again to apply it. Target macOS, comment each step, and never hard-code a real credential — read secrets from the environment.

Added an additional IP to en0

Adds an IP alias to en0 with ifconfig … alias, and removes it again.

Commands
sudo ifconfig en0 alias <INTERNAL_IP> up  Interface:  en0  IP to add:  <INTERNAL_IP>  Subnet:  24
# Remove the IP
sudo ifconfig en0 -alias <INTERNAL_IP>
AI prompt

Generate a Bash script for the task “Added an additional IP to en0”. Parameterise the interface, address and netmask; add the alias with ifconfig <iface> alias, remove it with ifconfig <iface> -alias, and print the interface’s addresses after each change. Target macOS, comment each step, and never hard-code a real credential — read secrets from the environment.

Add firewall rules to /etc/pf.conf

Adds a named anchor to /etc/pf.conf that loads extra packet-filter rules from a separate file.

Commands
anchor goodguys
load anchor goodguys from "/opt/scripts/mac/pf/<PF_ANCHOR_FILE>
AI prompt

Generate a Bash script for the task “Add firewall rules to /etc/pf.conf”. Parameterise the anchor name and rules file; back up /etc/pf.conf, add the anchor and load anchor lines if missing, check the syntax with pfctl -nf, then load it with pfctl -f and enable pf with pfctl -e. Target macOS, comment each step, and never hard-code a real credential — read secrets from the environment.