# Homebrew Formula Scraper - Metadata & Analytics (`klondikeking/homebrew-formula-scraper`) Actor

Extract Homebrew formula metadata, dependencies, download analytics, and installation statistics using the official Homebrew JSON API. Fast, reliable, and proxy-free.

- **URL**: https://apify.com/klondikeking/homebrew-formula-scraper.md
- **Developed by:** [Pierrick McD0nald](https://apify.com/klondikeking) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 1 total users, 0 monthly users, 96.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 formula extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Homebrew Formula Scraper — Package Metadata & Analytics Extractor

Extract comprehensive metadata, dependency trees, and download analytics for Homebrew formulas using the official Homebrew JSON API. This Actor retrieves formula names, descriptions, licenses, versions, dependency information, and installation statistics across 30, 90, and 365-day windows. Perfect for developer tooling research, package management analysis, and macOS/Linux ecosystem monitoring.

### Use Cases

- **Package Research** — Discover popular Homebrew formulas, compare versions, and analyze dependency graphs for macOS and Linux development environments.
- **Security Auditing** — Track deprecated and disabled formulas, monitor deprecation reasons, and identify packages with security concerns or outdated dependencies.
- **Ecosystem Analysis** — Study installation trends across 30, 90, and 365-day windows to understand developer tooling adoption and popularity shifts.
- **License Compliance** — Extract license information for all installed formulas to ensure compliance in corporate or open-source environments.
- **Dependency Mapping** — Build complete dependency trees including build, runtime, test, recommended, and optional dependencies for any formula.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `searchQuery` | String | No | Optional keyword to filter formulas by name or description (e.g., "python", "node") |
| `maxItems` | Integer | No | Maximum formulas to extract (default: 100, max: 1000) |
| `sortBy` | String | No | Sort results by: downloads30d, downloads90d, downloads365d, or name (default: downloads30d) |
| `includeDeprecated` | Boolean | No | Include deprecated formulas (default: false) |
| `includeDisabled` | Boolean | No | Include disabled formulas (default: false) |
| `proxyConfiguration` | Object | No | Proxy configuration for requests |

### Output

The Actor outputs a dataset with the following fields for each formula:

```json
{
  "name": "node",
  "fullName": "node",
  "description": "Platform built on V8 to build network applications",
  "homepage": "https://nodejs.org/",
  "license": "MIT",
  "stableVersion": "22.3.0",
  "headVersion": null,
  "bottleAvailable": true,
  "buildDependencies": ["pkgconf"],
  "dependencies": ["ca-certificates"],
  "testDependencies": [],
  "recommendedDependencies": [],
  "optionalDependencies": [],
  "kegOnly": false,
  "deprecated": false,
  "deprecationDate": null,
  "deprecationReason": null,
  "disabled": false,
  "disableDate": null,
  "disableReason": null,
  "analytics30d": 125430,
  "analytics90d": 389210,
  "analytics365d": 1523840,
  "rubySourcePath": "Formula/n/node.rb",
  "tap": "homebrew/core",
  "generatedDate": "2024-06-16"
}
```

### Pricing

Pay per event: $0.001 per formula extracted.

### Limitations

- The Homebrew API is updated periodically; analytics data may lag by a few hours.
- Very large `maxItems` values (1000) may take 30-60 seconds due to individual formula detail API calls.
- Formulas with no installation data in the analytics period will show null for analytics fields.
- Rate limits on the Homebrew API are generous but not officially documented; the Actor includes retries and graceful backoff.

### FAQ

**Q: Can I extract all 8,000+ formulas at once?**
A: Yes, set `maxItems` to 1000. The Actor will fetch the most popular formulas by default. To get all formulas, sort by name and run multiple times with different search queries.

**Q: Why are some analytics fields null?**
A: Homebrew only tracks analytics for formulas with installations. If a formula has zero installs in the tracked period, the analytics field will be null.

**Q: Do I need a proxy?**
A: No, the Homebrew API is public and does not require authentication or proxy. However, you can configure a proxy if your network requires it.

### Changelog

- **v1.0.0** — Initial release with full formula metadata, dependency trees, and installation analytics

# Actor input Schema

## `searchQuery` (type: `string`):

Optional keyword to filter formulas by name or description

## `maxItems` (type: `integer`):

Maximum number of formulas to extract (1-1000)

## `sortBy` (type: `string`):

Sort order for results

## `includeDeprecated` (type: `boolean`):

Include formulas that have been deprecated

## `includeDisabled` (type: `boolean`):

Include formulas that have been disabled

## `proxyConfiguration` (type: `object`):

Configure proxy settings for the scraper

## Actor input object example

```json
{
  "searchQuery": "python",
  "maxItems": 10,
  "sortBy": "downloads30d",
  "includeDeprecated": false,
  "includeDisabled": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Link to the extracted Homebrew formula dataset

## `stats` (type: `string`):

Statistics about the run including items extracted and errors

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQuery": "python",
    "maxItems": 10,
    "sortBy": "downloads30d",
    "includeDeprecated": false,
    "includeDisabled": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("klondikeking/homebrew-formula-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQuery": "python",
    "maxItems": 10,
    "sortBy": "downloads30d",
    "includeDeprecated": False,
    "includeDisabled": False,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("klondikeking/homebrew-formula-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQuery": "python",
  "maxItems": 10,
  "sortBy": "downloads30d",
  "includeDeprecated": false,
  "includeDisabled": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call klondikeking/homebrew-formula-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=klondikeking/homebrew-formula-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/281ugC7UZSkZ4yq2B/builds/UjdeRn2MPsFIYeXb3/openapi.json
