Skip to content

Automatic Installation

Melvin PETIT edited this page Jun 17, 2026 · 1 revision

Automatic Installation

You do not need the wrapped tools installed up front. When you pick a tool whose binary is not on your PATH, FeedYourSpider offers to install it using your system's package manager. This is handled by one helper, so every module gets the behavior for free.

The flow

Each module's first line is an availability check:

ensure_command nmap "apt=nmap dnf=nmap ... brew=nmap" "nmap" || return 0

ensure_command does the following:

  1. If the binary is already on PATH, return immediately.
  2. Otherwise, warn and call install_package.
  3. Re-check that the binary now exists. If it still does not, log an error and return non-zero so the module bails cleanly back to the menu.

Detecting the package manager

detect_package_manager echoes exactly one of:

brew | apt | dnf | yum | pacman | zypper | apk | unknown

On macOS (uname = Darwin) with Homebrew present it returns brew. Otherwise it probes for apt-get, dnf, yum, pacman, zypper, apk in that order and returns the first found. If none match, it returns unknown and installation is refused with a "install manually" message.

Package name mapping

The same tool is named differently across distributions, so each module passes a mapping string of pm=package pairs plus a fallback:

ensure_command nc \
  "apt=netcat-openbsd dnf=nmap-ncat yum=nmap-ncat pacman=openbsd-netcat \
   zypper=netcat-openbsd apk=netcat-openbsd brew=netcat" \
  "netcat"

install_package picks the pair matching the detected manager; if none matches, it uses the fallback (the second argument). Then it runs the appropriate command:

Manager Command
apt sudo apt-get update && sudo apt-get install -y <pkg>
dnf sudo dnf install -y <pkg>
yum sudo yum install -y <pkg>
pacman sudo pacman -Sy --noconfirm <pkg>
zypper sudo zypper --non-interactive install <pkg>
apk sudo apk add <pkg>
brew brew install <pkg> (no sudo)

What this means for you

  • On Linux you will be prompted for your sudo password during an install.
  • On macOS, Homebrew installs run without sudo, so make sure brew is on your PATH.
  • If your distribution uses a manager not in the list above, the install step reports unknown and asks you to install the tool yourself; the rest of the launcher still works.

Why one helper

Centralizing this in ensure_command / install_package is what keeps a new tool module around 30 lines: there is no per-tool command -v / apt-get / brew boilerplate to copy. See Extending FeedYourSpider.

Clone this wiki locally