# 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, 25.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Homebrew Formula Scraper - Metadata & Analytics",
        "description": "Extract Homebrew formula metadata, dependencies, download analytics, and installation statistics using the official Homebrew JSON API. Fast, reliable, and proxy-free.",
        "version": "1.0",
        "x-build-id": "UjdeRn2MPsFIYeXb3"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/klondikeking~homebrew-formula-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-klondikeking-homebrew-formula-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/klondikeking~homebrew-formula-scraper/runs": {
            "post": {
                "operationId": "runs-sync-klondikeking-homebrew-formula-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/klondikeking~homebrew-formula-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-klondikeking-homebrew-formula-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Optional keyword to filter formulas by name or description",
                        "default": ""
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of formulas to extract (1-1000)",
                        "default": 100
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "downloads30d",
                            "downloads90d",
                            "downloads365d",
                            "name"
                        ],
                        "type": "string",
                        "description": "Sort order for results",
                        "default": "downloads30d"
                    },
                    "includeDeprecated": {
                        "title": "Include Deprecated Formulas",
                        "type": "boolean",
                        "description": "Include formulas that have been deprecated",
                        "default": false
                    },
                    "includeDisabled": {
                        "title": "Include Disabled Formulas",
                        "type": "boolean",
                        "description": "Include formulas that have been disabled",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Configure proxy settings for the scraper"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
