# Install swift-sh with Homebrew

Scripting with easy zero-conf dependency imports. Version 2.5.0 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:swift-sh
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install swift-sh
```

  Evidence: local Homebrew formula metadata

## Package facts

- **Package key:** brew:swift-sh
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/swift-sh>
- **Version:** 2.5.0
- **Source summary:** Scripting with easy zero-conf dependency imports
- **Homepage:** <https://github.com/mxcl/swift-sh>
- **Repository:** <https://github.com/mxcl/swift-sh>
- **Upstream docs:** <https://github.com/mxcl/swift-sh#readme>
- **License:** Unlicense
- **Source archive:** <https://github.com/mxcl/swift-sh/archive/refs/tags/2.5.0.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- swift-sh (cli)
- swift-sh-edit (cli)
- swift-sh (alias)
- swift-sh-edit (alias)

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.5.0
- Local data: ok
- Upstream repository: https://github.com/mxcl/swift-sh
- Upstream latest detected: 2.5.0 (current)
- info: No package-manager update timestamp was available.
## Project history and usage

swift-sh is a Swift scripting tool that lets single-file Swift scripts declare third-party SwiftPM dependencies inline on import statements, then builds and runs those scripts through Swift Package Manager.

### Project history

The public repository was created in 2019. The README frames the project as a response to the friction of turning a quick Swift script into a full Swift package just to use dependencies, offering a shebang-based workflow instead.

### Adoption history

The README documents Homebrew installation and explains that the installed `swift-sh` executable is discoverable through Swift's subcommand mechanism as `swift sh`. Homebrew lists bottles for macOS and Linux, matching the README's stated support for Linux and Mac.

### How it is used

A script starts with `#!/usr/bin/swift sh` and declares dependencies in comments after import lines. swift-sh reads those comments, creates a cached SwiftPM package, builds it, and runs it with `swift run`; it also documents `swift sh edit` for Xcode editing and `swift sh eject` for converting a script into a package.

### Why package nerds care

swift-sh matters in package-manager culture because it narrows the gap between scripting and package-based dependency resolution. It makes SwiftPM usable for disposable or operational scripts without asking users to keep a full package directory around from the start.

### Timeline

- 2019: Public GitHub repository created.
- Current docs: Installed with Homebrew or built manually with `swift build`.
- Current docs: v2 requires Swift 5.1 and uses the active Swift toolchain to generate the temporary package manifest.

### Related projects

- The README lists Beak and Marathon as alternatives and builds on Swift Package Manager, Xcode, and Swift's subcommand dispatch behavior.

### Sources

- <https://api.github.com/repos/mxcl/swift-sh>
- <https://formulae.brew.sh/api/formula/swift-sh.json>
- <https://github.com/mxcl/swift-sh#readme>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** swift-sh
- **Version Scheme:** 0
- **Revision:** 1
- **Head Version:** HEAD
- **Requirements:** xcode
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [objc-run](https://www.automicvault.com/pkg/brew/objc-run/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [rust-script](https://www.automicvault.com/pkg/brew/rust-script/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [scriptisto](https://www.automicvault.com/pkg/brew/scriptisto/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [swift-outdated](https://www.automicvault.com/pkg/brew/swift-outdated/) - Shares av.db curated category or tags: cli, dependency-management, developer-tools, swift, swift-package-manager.
- [zx](https://www.automicvault.com/pkg/brew/zx/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [bar](https://www.automicvault.com/pkg/brew/bar/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [boot-clj](https://www.automicvault.com/pkg/brew/boot-clj/) - Shares av.db curated category or tags: cli, developer-tools, scripting.
- [cargo-features-manager](https://www.automicvault.com/pkg/brew/cargo-features-manager/) - Shares av.db curated category or tags: cli, dependency-management, developer-tools.
- [carthage](https://www.automicvault.com/pkg/brew/carthage/) - Local package facts share a topical domain. Shared terms: cli, dependency, dependency-management, developer, developer-tools.
- [swift-format](https://www.automicvault.com/pkg/brew/swift-format/) - Package names and metadata indicate a similar tool family. Shared terms: cli, developer, developer-tools, swift.

## Combined YAML source

View the package source record on GitHub. [combined/swift-sh.yml](https://github.com/automic-vault/db/blob/main/combined/swift-sh.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- cross-ecosystem install command graph
