Use Mint to install Swift command line tool package without root permission

September 01, 20232 min read#ios, #cli, #swift

mint

Why?

iOS engineers often use a lot of execution tools for their works, e.g SwiftLint, SwiftFormat etc …

On macOS, we can easily install those tools using homebrew.

But there are few drawback when using homebrew, such as:

  • It’s not easy to install a specific version of a tool with homebrew.
  • homebrew might be restricted in enterprise environment, where devs normally don’t have root access on their machines.

Thankfully, many modern Swift CLI tools are supporting an alternative way to install them: Mint

Mint is a package manager that installs and runs Swift command line tool packages.

  • ✅ easily run a specific version of a package
  • ✅ link a package globally
  • ✅ builds are cached by version
  • ✅ use different versions of a package side by side
  • ✅ easily run the latest version of a package
  • ✅ distribute your own packages without recipes and formulas
  • ✅ specify a list of versioned packages in a Mintfile for easy use

How?

Step 1

There are different ways to install Mint.

The easiest way is to use homebrew 😅

brew install mint

Step 2

Add mint binary fodler into PATH, such as adding the following line into your ~/.zshrc

export PATH="$HOME/.mint/bin:$PATH"

Reload your shell profile:

source ~/.zshrc

Step 3

After Mint is installed, you can use Mint to install other Swift CLI tool, such as Periphery

mint install peripheryapp/periphery

periphery

Conclusion

Mint is an easy to use, less restrictive and highly optimised for Swift CLI package.

Mint is especially CI/CD friendly as well.

If your working environemnt is restrictive to use homebrew properly, you can consider to use Mint to install necessary Swift CLI tools.

Quick Drop logo

Profile picture

Personal blog by An Tran. I'm focusing on creating useful apps.
#Swift #Kotlin #Mobile #MachineLearning #Minimalist


© An Tran - 2024