Skip to content

Instantly share code, notes, and snippets.

@paulp
Created March 8, 2018 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulp/e44777ac3d3d906c199cabc769c4215b to your computer and use it in GitHub Desktop.
Save paulp/e44777ac3d3d906c199cabc769c4215b to your computer and use it in GitHub Desktop.
Mine macports sqlite database for package of origin for each program in /opt/local/bin.
#!/usr/bin/env bash
#
DB="/opt/local/var/macports/registry/registry.db"
QUERY="select ports.name,files.path
from files
inner join ports
on files.id=ports.id AND files.path GLOB '/opt/local/bin/*'"
sqlite3 -list -separator ' ' "$DB" "$QUERY" \
| while read -r port path; do echo "$port: $(basename "$path")"; done \
| sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment