Homebrew for Swift packages

Overview

Swiftbrew

A package manager that installs prebuilt Swift command line tool packages, or Homebrew for Swift packages.

Installation

Homebrew

brew install swiftbrew/tap/swiftbrew

Mint

mint install swiftbrew/Swiftbrew

Swiftbrew

swift brew install swiftbrew/Swiftbrew

Usage

swift brew install <package-reference>

Package reference can be a shorthand for a GitHub repository (Carthage/Carthage) or a full git URL (https://github.com/Carthage/Carthage.git), optionally followed by a tagged version (@x.y.z). Swiftbrew currently only supports public repositories.

Examples

Install the latest version of Carthage:

swift brew install Carthage/Carthage

or

swift brew install https://github.com/Carthage/Carthage

Install Carthage version 0.33.0:

swift brew install Carthage/[email protected]

Why create another package manager?

Homebrew is a popular method of distributing command line tools on macOS. Some popular Swift command line tools are already distributed via Homebrew. But there are some limitations:

  • Distributing via Homebrew requires you to create a formula and then maintain that formula.
  • If your package is not popular enough to be accepted into Homebrew's core formulae, you would have to create and maintain your own tap.
  • As a package maintainer, a usual release process would be: build the executable, archive it into a tarball/zipball, upload it to GitHub releases, bump formula version. This is a cumbersome process.
  • It can be tricky to install a specific version of a tool with Homebrew.

Mint is a package manager that builds and installs Swift command line tool packages. Mint is more flexible than Homebrew as it allows installing a specific version of a package. The downside of Mint is that it requires you to build all packages from source. This can be very time-consuming as you start replacing most of your Ruby tools in your iOS project with Swift packages, since bumping a tool version would require rebuilding it from all your developers' machines.

Introducing Swiftbrew

Swiftbrew saves Swift packages maintainers and users' time by caching prebuilt Swift command line tool packages, while flexible enough to let users install multiple versions of a package. Swiftbrew builds and caches Swift packages on CDN servers so that they are fast to download from anywhere. Swiftbrew bottles (prebuilt packages) are hosted on Bintray, the same service that hosts Homebrew bottles. If any package is not available as a bottle, it will be built by Swiftbrew build workers and cached after the first installation request, so that it will available for everyone later on. Here is what an installation output looks like:

$ swift brew install Carthage/Carthage

==> Finding latest version of Carthage
Resolved latest version of Carthage to 0.33.0
==> Installing Carthage 0.33.0
==> Downloading https://dl.bintray.com/swiftbrew/bottles/github.com_Carthage_Carthage-0.33.0.mojave.tar.xz
Bottle not yet available. Sent a build request to build workers.
==> Waiting for bottle to be available...
==> Pouring github.com_Carthage_Carthage-0.33.0.mojave.tar.xz
🍺  /usr/local/lib/swiftbrew/cellar/github.com_Carthage_Carthage/build/0.33.0

FAQ

What kind of packages can Swiftbrew install?

Swiftbrew can install any public Swift command line tool package. If your package can be built with swift build command, then it can be installed via Swiftbrew.

Can I add my own package?

Yes, if your package's Git URL is public. Just install your package with Swiftbrew, a built request will be sent to Swiftbrew's build workers, then the bottle will be available after a few minutes.

What platforms does Swiftbrew support?

We only have build workers that run macOS Mojave in the meantime. Other macOS versions and Linux may be added in the future upon community requests.

License

MIT

You might also like...
Start your next Open-Source Swift Framework πŸ“¦
Start your next Open-Source Swift Framework πŸ“¦

SwiftKit enables you to easily generate a cross platform Swift Framework from your command line. It is the best way to start your next Open-Source Swi

Easily generate cross platform Swift framework projects from the command line
Easily generate cross platform Swift framework projects from the command line

SwiftPlate Easily generate cross platform Swift framework projects from the command line. SwiftPlate will generate Xcode projects for you in seconds,

A Swift command line tool for generating your Xcode project
A Swift command line tool for generating your Xcode project

XcodeGen XcodeGen is a command line tool written in Swift that generates your Xcode project using your folder structure and a project spec. The projec

A Swift playground that comes pre-loaded with Plot, that can be used to explore the new component API.

PlotPlayground A Swift playground that comes pre-loaded with Plot, so that you can quickly try out the library and its new, SwiftUI-like API for build

[Accepted] WWDC21 Swift Student Challenge Submission

Hear See Tell us about the features and technologies you used in your Swift playground. Swift Playground Author Template: providing the general struct

🌳 Environment – a nicer, type-safe way of working with environment variables in Swift.

🌳 Environment Welcome to Environment – a nicer, type-safe way of working with environment variables in Swift. Usage Access Environment Variables The

A Swift wrapper around the CoreSymbolication private framework on macOS.

CoreSymbolication provides a very powerful system for looking up and extracting symbolic information from mach-o executables, dyld shared caches, and dSYMs.

SwiftTypeReader - You can gather type definitions from Swift source code.

SwiftTypeReader - You can gather type definitions from Swift source code.

A thread safe throttle written in Swift

SwiftThrottle - A thread safe throttle written in Swift licensed under MIT. Introduction This throttle is intended to prevent the program from crashing

Comments
  • Why not implement the caching functionality inside mint, instead of creating another package manager?

    Why not implement the caching functionality inside mint, instead of creating another package manager?

    Why not implement the caching functionality inside mint, instead of creating another package manager?

    Seems to me a win-win: the functionality is more widely spread and the community gets an improved package manager, instead of having to decide between package managers.

    opened by acecilia 0
  • Not working on macOS Catalina beta 2

    Not working on macOS Catalina beta 2

    I know this is beta software, but it would be still great to get this fixed if possible, especially given that Homebrew currently doesn't support the tightened security of Catalina yet, which is a great opportunity for this library to gain some initial traction.

    Here's the command and the error I'm currently getting after installing Swiftbrew via Mint:

    swift brew install JamitLabs/Accio
    This copy of libswiftCore.dylib requires an OS version prior to 10.14.4.
    Abort trap: 6
    

    My command line tools are set to Xcode 10.2.1.

    opened by Jeehut 4
Releases(0.2.0)
Owner
Swiftbrew
Homebrew for Swift packages
Swiftbrew
Delightful code generation for OpenAPI specs for Swift written in Swift

Create API Delightful code generation for OpenAPI specs for Swift written in Swi

Alexander Grebenyuk 286 Dec 23, 2022
WebDomHandling - A Swift Package for handling JavaScript code between WebKit and Swift implemented by WebKit

WebDomHandling A Swift Package for handling JavaScript code between WebKit and S

null 0 Jan 23, 2022
A very simplistic state machine system for Swift while mainly used with Raylib on Swift

A very simplistic state machine system for Swift while mainly used with Raylib on Swift

Conifer Coniferoslav 2 Dec 12, 2022
A Swift SPM framework for running and managing Lua code from Swift

LuaKit A Swift Package for running and managing Lua code from Swift. Documentation For documentation, add this package as Swift Package Dependency, an

GGorAA 5 Nov 24, 2022
This is a Swift Package bundling different Train APIs into one simple Swift interface.

This is a Swift Package bundling different Train APIs into one simple Swift interface.

ICE Buddy 8 Jul 5, 2022
Beak 🐦 Peck into your Swift files from the command line

Beak ?? Peck into your Swift files from the command line Beak can take a standard Swift file and then list and run any public global functions in it v

Yonas Kolb 566 Dec 6, 2022
A Collection of PropertyWrappers to make custom Serialization of Swift Codable Types easy

CodableWrappers Simplified Serialization with Property Wrappers Move your Codable and (En/De)coder customization to annotations! struct YourType: Coda

null 393 Jan 5, 2023
Turn your Swift data model into a working CRUD app.

Model2App is a simple library that lets you quickly generate a CRUD iOS app based on just a data model defined in Swift. (CRUD - Create Read Update De

Q Mobile 132 Dec 22, 2022
OpenAPI/Swagger 3.0 Parser and Swift code generator

SwagGen SwagGen is a library and command line tool for parsing and generating code for OpenAPI/Swagger 3.0 specs, completely written in Swift. Swagger

Yonas Kolb 568 Jan 5, 2023
The Swift code generator for your assets, storyboards, Localizable.strings, … β€” Get rid of all String-based APIs!

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

null 8.3k Dec 31, 2022