Swiftpack.co - Package - yonaskolb/Mint

Mint ๐ŸŒฑ

SPM Platforms Git Version license

A package manager that installs and runs Swift command line tool packages.

$ mint run realm/SwiftLint@0.22.0

This would install and run SwiftLint version 0.22.0

Mint is designed to be used with Swift command line tools that build with the Swift Package Manager. It makes installing, running and distributing these tools much easier.

  • โœ… easily run a specific version of a package
  • โœ… link a package globally
  • โœ… builds are cached by version
  • โœ… use different versions of a package side by side
  • โœ… easily run the latest version of a package
  • โœ… distribute your own packages without recipes and formulas
  • โœ… specify a list of versioned packages in a Mintfile for easy use

Homebrew is a popular method of distributing Swift executables, but that requires creating a formula and then maintaining that formula. Running specific versions of homebrew installations can also be tricky as only one global version is installed at any one time. Mint installs your package via SPM and lets you run multiple versions of that package, which are installed and cached in a central place.

If your Swift executable package builds with SPM, then it can be run with Mint! See Support for details.

Why is it called Mint?

Swift Packager Manager Tools -> SPMT -> Spearmint -> Mint! ๐ŸŒฑ๐Ÿ˜„

Mint: a place where something is produced or manufactured


Make sure Xcode 10.2 is installed first.


$ brew install mint


$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ make

Using Mint itself!

$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ swift run mint install yonaskolb/mint
$ mint install yonaskolb/mint

Swift Package Manager


$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ swift run mint

Use as dependency

Add the following to your Package.swift file's dependencies:

.package(url: "https://github.com/yonaskolb/Mint.git", from: "0.10.0"),

And then import wherever needed: import MintKit

Road to 1.0

Until 1.0 is reached, minor versions will be breaking.


Run mint help to see usage instructions.

  • install: Installs a package, so it can be run with run later, and also links that version globally
  • run: Runs a package. This will install it first if it isn't already installed, though won't link it globally. It's useful for running a certain version.
  • list: Lists all currently installed packages and versions.
  • which: Print the path to an installed package executable.
  • uninstall: Uninstalls a package by name.
  • bootstrap: Installs all the packages in your Mintfile, by default, without linking them globally

Package reference

run and install commands require a package reference parameter. This can be a shorthand for a github repo (mint install realm/SwiftLint) or a fully qualified git path (mint install https://github.com/realm/SwiftLint.git). In the case of run you can also just pass the name of the repo if it is already installed (run swiftlint) or in the Mintfile. An optional version can be specified by appending @version, otherwise the newest tag or master will be used. Note that if you don't specify a version, the current tags must be loaded remotely each time.


$ mint run yonaskolb/XcodeGen@1.2.4 # run the only executable
$ mint run yonaskolb/XcodeGen@1.2.4 --spec spec.yml # pass some arguments
$ mint run yonaskolb/XcodeGen@1.2.4 xcodegen --spec spec.yml # specify a specific executable
$ mint run --executable xcodegen yonaskolb/XcodeGen@1.2.4 --spec spec.yml # specify a specific executable in case the first argument is the same name as the executable
$ mint install yonaskolb/XcodeGen@1.2.4 --no-link # installs a certain version but doesn't link it globally
$ mint install yonaskolb/XcodeGen # install newest tag
$ mint install yonaskolb/XcodeGen@master --force #reinstall the master branch
$ mint run yonaskolb/XcodeGen@1.2.4 # run 1.2.4
$ mint run XcodeGen # use newest tag and find XcodeGen in installed packages


By default Mint symlinks your installs into usr/local/bin on mint install, unless --no-link is passed. This means a package will be accessible from anywhere, and you don't have to prepend commands with mint run package. Note that only one linked version can be used at a time though. If you need to run a specific older version use mint run.


A Mintfile can specify a list of versioned packages. It makes installing and running these packages easy, as the specific repos and versions are centralized.

Simply place this file in the directory you're running Mint in. The format of the Mintfile is simply a list of packages in the same form as the usual package parameter:


Then you can simply run a package with:

mint run xcodegen

Or install all the packages (without linking them globally) in one go with:

mint bootstrap

If you prefer to link them globally, do such with:

mint bootstrap --link


  • You can use --silent in mint run to silence any output from mint itself. Useful if forwarding output somewhere else.
  • You can set MINT_PATH and MINT_LINK_PATH envs to configure where mint caches builds, and where it symlinks global installs. These default to /usr/local/lib/mint and /usr/local/bin respectively
  • You can use mint install --force to reinstall a package even if it's already installed. This shouldn't be required unless you are pointing at a branch and want to update it.


Mint works on Linux but has some limitations:

  • linux doesn't support building with a statically linked version of Swift. This means when a new version of swift comes out the old installs won't work on linux.
  • Linux is case sensitive so you must specify the correct case for repo urls as well as executables.


If your Swift command line tool builds with the Swift Package Manager than it will automatically install and run with mint!

Make sure you have defined an executable product type in the products list within your Package.swift.

let package = Package(
    name: "Foo",
    products: [
        .executable(name: "foo", targets: ["Foo"]),
    targets: [
      .target(name: "Foo"),

You can then add this to the Installing section in your readme:

### [Mint](https://github.com/yonaskolb/mint)
$ mint install github_name/repo_name


Since Swift 5.3 resources are now built into the Swift Package manager, so if you're targetting that version or above the Package.resources file is no longer necessary https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md

The Swift Package Manager doesn't yet have a way of specifying resources directories. If your tool requires access to resources from the repo you require a custom Package.resources file. This is a plain text file that lists the resources directories on different lines:


If this file is found in you repo, then all those directories will be copied into the same path as the executable.

A list of popular Mint compatible packages ๐ŸŒฑ

Feel free to add your own!


Stars: 1385


0.14.2 - 2020-04-13 13:02:14


  • Changeed list output to show what executables are installed if they differ from package name, and also disambiguate packages with the same name and different sources #170 @acecilia


  • Fixed the run to support when a package with the same name is installed from different origins (for example: yonaskolb/xcodegen and acecilia/xcodegen). #170 @acecilia
  • Fix the uninstall option: previously, the name for the symlink to remove was calculated using the package name passed from command line, which could be partial (for example simple instead of simplepackage), resulting on the symlink not being removed. #170 @acecilia
  • Fixed installing versions that reference a git sha #172 @yonaskolb
  • Added escaping of paths when linking. Avoids an error, when MINT_LINK_PATH contains spaces. @lutzifer


0.14.1 - 2020-02-13 12:09:37


  • Fixed some verbose output being shown in non verbose states


0.14.0 - 2020-02-13 11:33:28


  • Added --no-install option to mint run #160 @yonaskolb
  • Added mint which command for printing the path of an executable #162 @yonaskolb
  • The executable no longer needs to be provided in mint run when passing arguments if there is only a single executable in the package eg: mint run realm/SwiftLint autocorrect #159 @yonaskolb


  • Moved output of some commands to --verbose and tweaked output #154 @yonaskolb


  • Fixed a bug that prevented the Mintfile from resolving a GitHub repository where the name contains a period #153 @liamnichols


  • Updated to SwiftCLI 6.0 #157 @yonaskolb
  • Replace CircleCI with Github actions #158 @yonaskolb


0.13.0 - 2019-10-14 11:46:24


  • Added the --link (or -l) flag to the bootstrap option, to optionally link the packages of a Mintfile globally #137 @acecilia


  • Fixed list of executables not showing when asking for to disambiguate between them #149 @yonaskolb


  • Updated dependencies and removed SwiftPM dependency


0.12.0 - 2019-03-29 09:44:22


  • Fixed building packages when running in Swift 5 #130 #131 @stefanomondino @yonaskolb


  • Updated to Swift 5 and dropped Swift 4.2 #131 @yonaskolb


0.11.3 - 2018-12-17 13:02:30


  • Improved output #116 @yonaskolb


0.11.2 - 2018-08-13 10:39:12


  • Packages can now be referenced by name in mint install when already installed #100 @yonaskolb


  • Fixed packages from Mintfile not being read correctly on mint run when specified by name #100 @yonaskolb


0.11.1 - 2018-08-09 11:26:56


  • Fixed not being able to pass arguments to mint run @yonaskolb


0.11.0 - 2018-08-07 13:19:06


  • Added Linux support #82 @yonaskolb
  • Executable names are now automatically read from Package.swift #95 @yonaskolb
  • All executables in Package.swift are now installed #95 @yonaskolb
  • If multiple executables exist and one is not provided in mint run it will ask you which one to run #95 @yonaskolb


  • Breaking: changed MINT_INSTALL_PATH env to MINT_LINK_PATH #97 @yonaskolb
  • Breaking: changed --prevent-global to --no-link #97 @yonaskolb
  • Breaking: replaced mint update with mint install --force #96 @yonaskolb
  • --silent now applies to mint install in addition to mint run @yonaskolb


  • Breaking: Swift packages without executable products are no longer supported
  • Breaking: Older style quoted command invocations are no longer supported. eg mint run realm/SwiftLint "swiftlint autocorrect"


  • Fixed Mintfile output not adhering to --silent #85 @yutailang0119
  • Fixed installing nested resourcs in Package.resources #93 @toshi0383


0.10.2 - 2018-06-23 03:37:09


  • Don't overwrite install path of already installed version until after successful build
  • Fixed version number output


  • Updated SwiftCLI 5.2.1 to allow nested help commands like mint help install


0.10.1 - 2018-06-07 08:54:36


  • Fixed environment variables not being passed via mint run @yonaskolb
  • Fixed mint bootstrap output referring to the wrong path for Mintfile @yonaskolb


0.10.0 - 2018-06-06 03:16:32


  • Added mint bootstrap command for installing all the packages in your Mintfile #79 @yonaskolb
  • Added --mintfile argument for custom Mintfile path #79 @yonaskolb
  • Added stdin support to mint run #78 @yonaskolb


  • Improved error output #78 @yonaskolb
  • Customizable standardOut and standardError in Mint #78 @yonaskolb
  • As global installs are now the default, replaced --global with --prevent-global flag @yonaskolb


  • Fixed output in run not being silenced when using a Mintfile #77 @yutailang0119
  • Removed dotfiles from mint list output @yonaskolb
  • Print errors to stderr #78 @yonaskolb


  • Replaced ShellOut with SwiftCLI #78 @yonaskolb
  • Replaced SPM with SwiftCLI #78 @yonaskolb


0.9.1 - 2018-04-13 02:11:31

  • made Mintfile package lookup case insensitive @yonaskolb
  • fixed Minfile lookup by simple name on install


0.9.0 - 2018-04-12 12:19:14

  • added Mintfile for adding a list versioned dependencies #72 @Lutzifer
  • added MINT_PATH and MINT_INSTALL_PATH environment variables #65 @yonaskolb
  • fixed build errors not being logged #71 @yonaskolb


0.8.0 - 2018-04-03 04:46:52

  • add ssh support #60 @Lutzifer
  • add --silent argument #64 @yonaskolb
  • build packages using the current version of macOS #61 @LinusU
  • bundle Swift with installations, so they don't fail with Swift updates #70 @yonaskolb
  • show globally installed packages with a * in mint list #56 @yutailang0119
  • Move homebrew formula from this repo to official homebrew repo (no more custom tap required) #63 yonaskolb
  • help output changes #55 @pixyzehn


0.7.1 - 2018-01-06 10:00:59

  • add backwards compatibility for mint run calls still using quotes
  • don't log error message from mint if run executable fails


0.7.0 - 2018-01-06 09:28:52

  • install and update now link the executable to usr/local/bin by default, for global usage. Disable this with --global:false #41 #44 #45
  • arguments to an executable no longer have to be surrounded in quotes. mint run yonaskolb/xcodegen xcodegen --spec myspec.yml
  • added streaming of run command output #36
  • added --verbose flag for cloning and building output #36
  • add MINT and RESOURCE_PATH envs #36
  • fixed ANSI color issue #36
  • replaced ShellOut with SwiftShell #36
  • added a whole bunch of tests


0.6.1 - 2017-12-01 09:33:22

  • Fixed calculation of latest version #30
  • Integrated SwiftPM for versioning, more integrations will follow #30


0.6.0 - 2017-11-30 22:39:46

  • Fixed issues on caseโ€sensitive file systems #19 @SDGGiesbrecht
  • Fixed updating branches and packages without checked in Package.resolved files #24
  • Package repos are now checked out fresh on each install #24
  • If not passing a version, tags are now fetched remotely #24
  • Clones are now shallow #28
  • Added mint list command for listing all installed package versions #25
  • Added mint --version #27

0.5.0 - 2017-10-13 15:33:39

  • BREAKING: Changed version from the second argument to an @ suffix on the repo


0.4.1 - 2017-10-03 15:39:07

  • Fixed installing a package without tags when version isn't specified #7 by @orta


0.4.0 - 2017-10-01 16:45:14

  • Fixed permission issues in High Sierra


0.3.0 - 2017-09-27 21:33:20

  • Made version optional (defaults to newest tagged release)
  • Made command name optional (defaults to trailing path in repo path)
  • Added update command

0.2.0 - 2017-09-27 19:57:40

  • Made CLI commands more robust, including help

0.1.0 - 2017-09-26 21:35:59

Initial release