Monday, December 14, 2015


This morning I was ready to move on to openssl and try to use that in a Swift Cocoa app. I came across this, which talks about Cocoapods.

So what is that? It is a dependency manager for iOS and macosx. If you want to add various libraries to your app, this will help keep the versions straight. Then I became aware that there is another such beast called Carthage. And I immediately liked their philosophy: "ruthlessly simple."

And their background at github.

So I worked through this tutorial, which didn't work in part, but that may be because it's about iOS, and I don't know much about iOS.

Here is the bottom line: we can get Carthage with Homebrew:

brew install carthage

Take a look:

> brew info carthage
carthage: stable 0.11 (bottled), HEAD
Decentralized dependency manager for Cocoa
/usr/local/Cellar/carthage/0.11 (29 files, 11M) *
Poured from bottle

Using it is really simple. We make a new Xcode project (UseEncryptor) that will use the Encryptor framework (which is on github here).

(It will also work with SSH).

In the root directory of UseEncryptor

> touch Cartfile
> open -a Xcode Cartfile

Put this text:

github "" "master"

The "master" part is important. A fundamental use of Carthage is to get compatible versions of all the frameworks/libraries you need. Since I don't have versions, I need something there. It could be a specific commit, like "bf155b9".

> carthage update
*** Fetching Encryptor
*** Checking out Encryptor at "6d1f5025d33657220a77850253f83aacc41e439c"
*** xcodebuild output can be found in /var/folders/1l/d7lmw_ln5hb933r7jbkt6mq00000gn/T/carthage-xcodebuild.Lbpiz6.log
*** Skipped building Encryptor due to the error:
Dependency "Encryptor" has no shared framework schemes

If you believe this to be an error, please file an issue with the maintainers at

So at first I had an error because I didn't have "master" but there was a second one, it is important to check the box "shared" under Build schemes



> carthage update
*** Fetching Encryptor
*** Checking out Encryptor at "bf155b9f4334ecc1f78ebcd357762eda8ebdbff6"
*** xcodebuild output can be found in /var/folders/1l/d7lmw_ln5hb933r7jbkt6mq00000gn/T/carthage-xcodebuild.t4Q2Vh.log
*** Building scheme "Encryptor" in Encryptor.xcodeproj

The compiled libraries are placed in folders under UseEncryptor/Carthage/, but we need to add them to the project.

For example, by dragging from the Finder window (in /Build) into the shared libraries thingie in Xcode.

Now just add this to the AppDelegate:

Debug window:

pw: mypassphrase
data: b7c673d78aa3363fd1b1be53672be05f6462991e
salt: 698e91585662

It works! It will also work for local files, as long as they are git repositories; e.g. the Cartfile could say:

git "file:///Users/telliott_admin/Swift-Frameworks/Encryptor" "master"

No comments: