Skip to content

Commit 3f9c138

Browse files
committed
docs: Mac pkg docs
1 parent e1606be commit 3f9c138

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
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
- [Artifacts](./artifacts/index.md)
2324
- [archives](./artifacts/archives.md)

book/src/installers/index.md

+2-1
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 cargo-dist config][config-installers]. The [`cargo dist init` command][init] provides an interactive UI for enabling/disabling them.
1920

@@ -77,8 +78,8 @@ Installers which support bundling:
7778
[msi]: ./msi.md
7879
[npm]: ./npm.md
7980
[homebrew]: ./homebrew.md
81+
[pkg]: ./pkg.md
8082

8183
[archives]: ../artifacts/archives.md
8284
[artifact-url]: ../reference/artifact-url.md
8385
[init]: ../reference/cli.md#cargo-dist-init
84-

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
@@ -528,7 +528,7 @@ pub enum DistError {
528528

529529
/// Missing configuration for a .pkg
530530
#[error("A Mac .pkg installer was requested, but the config is missing")]
531-
#[diagnostic(help("Please ensure a dist.mac-pkg-config section is present in your config. For more details see: https://example.com"))]
531+
#[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"))]
532532
MacPkgConfigMissing {},
533533

534534
/// User left identifier empty in init

0 commit comments

Comments
 (0)