Accessing the Sparkle Binary from its Swift Package
A common task when using the Sparkle framework is to update the appcast when you release an update to your app. Running the command to update the appcast requires access to the Sparkle binary. Finding the Sparkle binary can be difficult if you added Sparkle using the Swift Package Manager. But by using Xcode and the Finder, you can create a Terminal window in the right location to run Sparkle commands.
Overview
Running a Sparkle command when using the Swift Package Manager requires the following steps:
- Locate the Sparkle binary folder in the Finder.
- Go to the Sparkle binary folder in the Terminal.
- Run the Sparkle command.
Locate the Sparkle Binary Folder in the Finder
The easiest way to find the Sparkle binary folder is to use Xcode. The project navigator has an entry for Sparkle in the Package Dependencies section. Click the disclosure triangle next to the Sparkle entry.
The Sparkle binary is in the Referenced Binaries section. Select the Sparkle binary, right-click, and choose Show in Finder to open the Sparkle binary folder in the Finder.
Xcode 14 Update
Xcode 14 does not have a Referenced Binaries selection. Select the Sparkle 2.x item from the project navigator, right-click, and choose Show in Finder.
When you choose Show in Finder, the Finder takes you to a Sparkle
folder inside a checkouts
folder. That Sparkle
folder contains source code, not the scripts you need to run.
Move one directory above the checkouts
folder, which should be named Source Packages
. Go to the artifacts
folder. That’s where the Sparkle
folder you need is.
Go to the Sparkle Binary Folder in the Terminal
In the Finder you have to navigate one folder above the Sparkle folder to open the Sparkle folder in the Terminal. In the Finder toolbar is the name of the current folder, which should be Sparkle. Select the folder name, right-click and choose artifacts to move to the artifacts folder.
In the artifacts folder, select the Sparkle folder, right-click, and choose Services > New Terminal at Folder. A new terminal window will open at the correct location to run Sparkle commands.
Run the Sparkle Command from the Terminal
Now that you are in the right folder in the Terminal, you can run Sparkle commands. Since updating the appcast is the command you’ll run the most, I’ll use that as an example. To update the appcast, run the following command:
./bin/generate_appcast "/path/to/your app/Sparkle files"
Where the path is the path to the folder where the appcast.xml
file and the app file you are distributing (the .zip or .dmg file) reside on your Mac. I recommend placing those files in a place that is easy to reference so you don’t have to type an insanely long path to update the appcast.