# Running executables directly from URL

**URL:** <https://forums.swift.org/t/running-executables-directly-from-url/89404>\
**Category:** Package Manager\
**Created:** [September 7, 2026, 12:55pm UTC](https://forums.swift.org/t/running-executables-directly-from-url/89404 "2026-09-07T12:55:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjrscott](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jjrscott/32/12494_2.png) [@jjrscott](https://forums.swift.org/u/jjrscott)\
**Post date:** [September 7, 2026, 12:55pm UTC](https://forums.swift.org/t/running-executables-directly-from-url/89404/1 "2026-09-07T12:55:38Z")

</div>

Greetings. Is there a way to pull a package and execute its commands directly from the URL, taking into account dependancy rules, eg:

```shell
swift run --package-url https://github.com/jjrscott/echo --up-to-next-minor-from 0.1 echo "Hello World"

```

To reiterate, I explicitly wish to take advantage of dependancy rules such as `--up-to-next-minor-from 0.0.0` but avoid going through the following long, complicated, annoying, and error prone process which, when called, creates a package, adds the command repo as a dependancy, then makes the call:

```bash
#! /bin/sh

PACKAGE_PATH=$(mktemp -d)
SCRATCH_PATH=$PACKAGE_PATH/build

shift
REPO_URL=$1
shift
DEPENDANCY_RULE_TYPE=$1
shift
DEPENDANCY_RULE_VALUE=$1
shift

COMMAND_NAME=$(basename $REPO_URL)
COMMAND_PACKAGE_PATH=$SCRATCH_PATH/checkouts/$COMMAND_NAME

swift package --quiet --package-path $PACKAGE_PATH --scratch-path $SCRATCH_PATH init >> $PACKAGE_PATH/logs.txt
swift package --quiet --package-path $PACKAGE_PATH --scratch-path $SCRATCH_PATH add-dependency $REPO_URL $DEPENDANCY_RULE_TYPE $DEPENDANCY_RULE_VALUE
swift package --quiet --package-path $PACKAGE_PATH --scratch-path $SCRATCH_PATH update 2>> $PACKAGE_PATH/logs.txt

swift run --quiet --package-path $COMMAND_PACKAGE_PATH $@

```

If named `swift-package-run.sh` can be called thus:

```shell
swift-package-run.sh --package-url https://github.com/jjrscott/echo --up-to-next-minor-from 0.0.0 echo "Hello World"

```

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [September 8, 2026, 2:05am UTC](https://forums.swift.org/t/running-executables-directly-from-url/89404/2 "2026-09-08T02:05:17Z")

</div>

[disclaimer: does not answer the question as asked]

I do think this is the wrong command to be asking for; if you want to run something twice, at the very least there's an extra network request to check if any of the tags have changed. No, I think the interesting question here is "can we expose SwiftPM's tag-choosing as its own command", which would let you do

```shell
git clone --tags https://github.com/jjrscott/echo .
git switch --detach $(swift package choose-tag --up-to-next-minor-from 0.1)
swift run echo "hello"

```

or even

```shell
TAG="$(swift package choose-tag --up-to-next-minor-from 0.1 --package-url https://github.com/jjrscott/echo)"
git clone -b "$TAG" https://github.com/jjrscott/echo .
swift run echo "hello"

```

It's longer, sure, but it makes the network accesses explicit and avoidable. And you can still wrap it in a higher-level script if you want.

---

<div class="post-metadata">

**Author:** ![craigwrong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/craigwrong/32/34133_2.png) [@craigwrong](https://forums.swift.org/u/craigwrong)\
**Post date:** [September 8, 2026, 12:07pm UTC](https://forums.swift.org/t/running-executables-directly-from-url/89404/3 "2026-09-08T12:07:34Z")

</div>

Probably not what you're looking for but in case you didn't know it, there's _Mint_:

> **[GitHub - yonaskolb/Mint: A package manager that installs and runs...](https://github.com/yonaskolb/mint)**
>
> A package manager that installs and runs executable Swift packages

You can run packages at different versions like so: `mint run yonaskolb/XcodeGen@2.18.0`

---

<div class="post-metadata">

**Author:** ![jjrscott](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jjrscott/32/12494_2.png) [@jjrscott](https://forums.swift.org/u/jjrscott)\
**Post date:** [September 8, 2026, 12:37pm UTC](https://forums.swift.org/t/running-executables-directly-from-url/89404/5 "2026-09-08T12:37:28Z")

</div>

This is almost exactly what I need, with the only exception being that I think this should be built in to Swift Package Manager.
