Morpheu5
Morpheu5

Reputation: 2801

Installing Vapor on macOS without needing Homebrew

I am trying to get a Swift Vapor project started. Following the guide here, it seems that Homebrew is the only option. I already have MacPorts and prefer it in many ways to Homebrew. Unfortunately there is no port for Vapor, so I went for the SPM installation that Vapor people describe here. I had previous success with Kitura, so I thought why not with Vapor. Well, when you go and build your project, you get

$ swift build

[... build stuff ...]

note: you may be able to install ctls using your system-packager:

    brew install ctls

[... more build stuff ...]

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "shim.h"
    ^
[... more like that ...]

  /Users/morpheu5/web/vizex/api/.build/checkouts/crypto.git-7980259129511365902/Sources/Crypto/Cipher/Cipher+Method.swift:1:8: error: could not build Objective-C module 'CTLS'
import CTLS
    ^
<unknown>:0: error: build had 1 command failures
error: exit(1):/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/morpheu5/web/vizex/api/.build/debug.yaml

Apparently you really need this ctls package, and the only way of getting it appears to be through Homebrew/Tap.

I really don't want or need Homebrew, so how do I get to the bottom of this? I'd really like to give Vapor a try.

Upvotes: 6

Views: 1157

Answers (1)

tobygriffin
tobygriffin

Reputation: 5421

Obligatory 1: installing Homebrew is the easiest way. If you then decide you don't want Homebrew, it uninstalls quite neatly.

Obligatory 2: using a Linux VM is the second easiest way.

But to answer your question and manually install CTLS:

  1. Make sure you have the libraries for LibreSSL or OpenSSL installed (using MacPorts, presumably)

  2. Download the latest release of CTLS.

  3. From the release archive, rename macos.pc to ctls.pc and then edit it using a text editor. Change the paths to point to your LibreSSL/OpenSSL installation.

  4. Move the edited ctls.pc into your $PKG_CONFIG_PATH.

I have tested this and it works for me, with the caveat that I installed LibreSSL using Homebrew so I don't know where MacPorts will put it.

Upvotes: 5

Related Questions