nnex is a command-line tool that streamlines the distribution of Swift command-line executables via Homebrew. With a single command, nnex handles it all:
- ✅ Build optimized universal binaries for ARM and Intel architectures.
- ✅ Strip symbols to reduce binary size.
- ✅ Create a new Homebrew tap if needed.
- ✅ Create a GitHub release and attach the binary asset.
- ✅ Generate and upload a Homebrew formula to your Homebrew tap.
Instead of manually managing taps and formulae, let nnex do the heavy lifting for you. nnex also supports importing your own Homebrew taps to leverage existing setups.
nnex requires both Homebrew and the GitHub CLI (gh) to function properly. Please ensure they are installed and configured on your system before using nnex (you'll be prompted to install them if you use nnex without them).
If you're curious about some of the struggles I went through to get SwiftData to work in a standalone Swift Package and in a CI workflow, I wrote an article outlining my journey that you can check out here.
Install nnex with Homebrew
brew tap nikolainobadi/nntools
brew install nnexAlternatively, you can install it directly:
brew install nikolainobadi/tap/nnexnnex utilizes three subcommands: Brew, Build, and Config.
- Brew commands are used to interact with Homebrew and GitHub
- Build commands handle local binary building
- Config commands are used to set preferences
The tool follows a clean architecture with separation of concerns between command parsing, business logic, and infrastructure.
The publish command is the most important command in nnex. It allows you to build a binary, create a new GitHub release, upload the binary, and optionally publish a Homebrew formula. This command streamlines the entire process of distributing your executable.
nnex brew publishThis command runs in the current directory and prompts you for any missing information.
To streamline the command and skip interactive prompts, include version, notes/notes-file, and a commit-message in the command.
nnex brew publish --version 1.0.0 --notes-file MyReleaseNotes.md --commit-message "Updated the formula for MyCoolTool" --skip-testsIf a required option is not specified, nnex will prompt you to enter it interactively.
If both --notes and --notes-file are provided, the command will throw an error since they are mutually exclusive.
For more details and advanced usage, refer to the Command Reference.
To configure where any new Homebrew taps are created:
nnex config set-list-path /path/to/tap/folderTo display the current tap list folder path:
nnex config show-list-pathTo open the tap list folder in Finder:
nnex config open-list-folderTo set the default binary build type:
nnex config set-build-type releaseContributions are welcome! If you'd like to improve a command, add new integrations, or fix bugs:
- Fork the repo
- Create a new branch
- Submit a PR with a clear description
Issues and suggestions are also welcome via GitHub Issues.
- SwiftPickerKit - Interactive command-line selection interfaces
- NnGitKit - Git operations wrapper (GitShellKit)
- NnShellKit - Shell command execution utilities
- NnSwiftDataKit - SwiftData utilities and extensions
- Swift Argument Parser - Command-line argument parsing
- Files - File system operations
nnex is available under the MIT license. See the LICENSE file for more information.
