Skip to content

Commit ba532e0

Browse files
committed
docs: Mac pkg docs
1 parent a0b9042 commit ba532e0

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

book/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [npm](./installers/npm.md)
1919
- [homebrew](./installers/homebrew.md)
2020
- [msi](./installers/msi.md)
21+
- [pkg](./installers/pkg.md)
2122
- [updater](./installers/updater.md)
2223
- [Usage](./installers/usage.md)
2324
- [Artifacts](./artifacts/index.md)

book/src/installers/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Currently supported installers include:
1414
* [npm][]: an npm project that fetches and runs executables (for `npx`)
1515
* [homebrew][]: a Homebrew formula that fetches and installs executables
1616
* [msi][]: a Windows msi that bundles and installs executables
17+
* [pkg][]: a Mac pkg that bundles and installs executables
1718

1819
These keys can be specified via [`installer` in your dist config][config-installers]. The [`dist init` command][init] provides an interactive UI for enabling/disabling them.
1920

@@ -80,6 +81,7 @@ Our installers are meant to be usable as-is, without requiring any special optio
8081
[msi]: ./msi.md
8182
[npm]: ./npm.md
8283
[homebrew]: ./homebrew.md
84+
[pkg]: ./pkg.md
8385
[usage]: ./usage.md
8486

8587
[archives]: ../artifacts/archives.md

book/src/installers/pkg.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# pkg Installer
2+
3+
> Since 0.22.0
4+
5+
<!-- toc -->
6+
7+
This guide will walk you through setting up a [bundling][] macOS `pkg` installer, which is the native graphical installer format on macOS. It assumes you've already done initial setup of cargo-dist, as described in [the way-too-quickstart][quickstart], and now want to add a pkg to your release process.
8+
9+
## Setup
10+
11+
### Setup Step 1: run init and enable "pkg"
12+
13+
Rerun `cargo dist init` and when it prompts you to choose installers, enable "pkg". After you've selected "pkg", you'll be asked for two pieces of information:
14+
15+
- An "identifier": this is a unique identifier for your application in reverse-domain name format. For more information, see [Apple's documentation for `CFBundleIdentifier`](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1).
16+
- The install location: by default, the pkg installer will place your software in `/usr/local` on the user's system. You can specify an alternate location if you prefer.
17+
18+
Once init completes, some changes will be made to your project, **check all of them in**:
19+
20+
1. `installers = ["pkg]"]` will be added to `[workspace.metadata.dist]`
21+
2. `[package.metadata.dist.mac-pkg-config]` will be added to your packages with distable binaries.
22+
23+
### Setup Step 2: you're done! (time to test)
24+
25+
See [the quickstart's testing guide][testing] for the various testing options.
26+
27+
If the above steps worked, `cargo dist plan` should now include a pkg for each Mac platform you support. You can create an installer by running `cargo dist build` on a Mac; it will be placed next to your software in the `target/distrib` folder, and can be installed just by double-clicking it.
28+
29+
[quickstart]: ../quickstart/index.md
30+
[testing]: ../quickstart/rust.md#test-it-out
31+
[bundling]: ./index.md#bundling-installers

cargo-dist/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ pub enum DistError {
603603

604604
/// Missing configuration for a .pkg
605605
#[error("A Mac .pkg installer was requested, but the config is missing")]
606-
#[diagnostic(help("Please ensure a dist.mac-pkg-config section is present in your config. For more details see: https://example.com"))]
606+
#[diagnostic(help("Please ensure a dist.mac-pkg-config section is present in your config. For more details see: https://opensource.axo.dev/cargo-dist/book/installers/pkg.html"))]
607607
MacPkgConfigMissing {},
608608

609609
/// User left identifier empty in init

0 commit comments

Comments
 (0)