Getting Started with Micronaut CLI Installation
The Micronaut CLI (Command Line Interface) is a powerful tool that helps developers quickly scaffold, develop, and manage Micronaut applications. Let us delve into understanding how to install Micronaut CLI, its purpose, and the steps required to get it running on different operating systems.
1. What is Micronaut?
Micronaut is a modern, JVM-based, full-stack framework specifically designed for building modular, high-performance microservices, serverless applications, and cloud-native systems. It offers first-class support for Java, Kotlin, and Groovy, making it a flexible choice for JVM developers.
Unlike traditional Java frameworks that rely heavily on runtime reflection and proxies (such as Spring), Micronaut uses compile-time annotation processing for dependency injection, AOP (Aspect-Oriented Programming), and configuration. This unique approach drastically reduces memory usage and startup time, making it ideal for microservices and serverless environments like AWS Lambda or Google Cloud Functions.
Micronaut also integrates seamlessly with GraalVM to enable ahead-of-time (AOT) compilation into native executables, further improving performance and resource efficiency.
Key features of Micronaut include:
- Compile-time dependency injection: No reflection or runtime proxies, leading to better performance and smaller memory footprint.
- Fast startup time and low memory usage: Ideal for microservices and containerized environments.
- Seamless integration with GraalVM: Supports building native images for ultra-fast execution and minimal memory use.
- Reactive and non-blocking: Includes built-in support for reactive programming using RxJava, Project Reactor, etc.
- Built-in HTTP server/client: Lightweight Netty-based web server and declarative HTTP clients with easy configuration.
- Cloud-native readiness: Support for service discovery, distributed tracing, configuration management, and more.
- Modular architecture: Encourages separation of concerns and better maintainability.
1.1 What is Micronaut CLI?
The Micronaut CLI (Command Line Interface) is a development tool that simplifies the process of creating and managing Micronaut applications. It provides a quick and efficient way to bootstrap projects, generate application components, and execute various tasks — all from your terminal.
It comes with intelligent code generation capabilities, which reduces the boilerplate and enforces consistent project structure. This makes it especially helpful for teams or individuals working on multiple services within a microservices architecture.
The CLI allows you to:
- Generate new Micronaut projects: Quickly scaffold applications with the desired language (Java/Kotlin/Groovy), test framework, and build tool (Gradle/Maven).
- Create application components: Generate controllers, services, repositories, and other common artifacts with ease.
- Run the application locally: Use the built-in development server to test your application quickly.
- Build and test: Compile your app, run tests, or create executable JARs directly using CLI commands.
- Manage features: Enable or disable features (e.g., security, metrics, database integration) during project creation.
Whether you’re a solo developer or part of a larger team, the Micronaut CLI can significantly improve your productivity by automating repetitive tasks and reducing manual errors. You can also explore the Micronaut Documentation for more advanced CLI usage.
2. Installing Micronaut CLI (macOS & Windows)
2.1 On macOS
You can install Micronaut CLI on macOS using SDKMAN (recommended for ease and version control) or by manually downloading and setting it up.
2.1.1 Using SDKMAN (Recommended)
SDKMAN is a popular tool for managing parallel versions of multiple SDKs on Unix-based systems. It’s the easiest way to install and manage Micronaut CLI on macOS.
- Step 1 – Install SDKMAN: Open Terminal and run:
curl -s "https://get.sdkman.io" | bash
This downloads and installs SDKMAN on your system.
- Step 2 – Initialize SDKMAN: Once installed, you must initialize it in the current shell session:
source "$HOME/.sdkman/bin/sdkman-init.sh"
- Step 3 – Install Micronaut CLI: Use SDKMAN to install the latest stable version of Micronaut:
sdk install micronaut
- Step 4 – Verify installation: Confirm that Micronaut CLI is successfully installed by checking its version:
mn --version
2.1.2 Manual Installation
If you prefer not to use SDKMAN, you can install Micronaut CLI manually. This method gives you more control but requires a bit more setup.
- Step 1 – Download the CLI: Visit the official Micronaut Download Page and download the latest CLI zip file for your OS.
- Step 2 – Extract the zip: Unzip the downloaded file to a directory of your choice. For example:
sudo unzip micronaut-X.Y.Z.zip -d /opt/micronaut
Replace
X.Y.Zwith the actual version number. - Step 3 – Add to PATH: Open (or create) your shell profile file (like
~/.zshrcor~/.bash_profile) and add:export PATH="/opt/micronaut/bin:$PATH"
Then reload your terminal or run:
source ~/.zshrc
- Step 4 – Verify installation: Check that Micronaut CLI is accessible:
mn --version
2.2 On Windows
As SDKMAN does not natively support Windows, the recommended approach is to install the Micronaut CLI manually. This method is straightforward and only requires a few system configuration steps.
2.2.1 Manual Installation
- Step 1 – Download the CLI: Visit the official Micronaut download page and download the latest ZIP file for Windows. Make sure to download the version compatible with your system architecture (usually 64-bit).
- Step 2 – Extract the archive:
After downloading, right-click the ZIP file and choose “Extract All”. Extract it to a directory you can easily access, for example:C:\micronaut
Inside this folder, you should see a
bindirectory containing themncommand. - Step 3 – Add Micronaut to your system PATH:
This step ensures you can run themncommand from any Command Prompt window:- Right-click This PC or My Computer and select Properties.
- Click on Advanced system settings.
- In the System Properties dialog, click the Environment Variables button.
- Under System variables, find and select the Path variable, then click Edit.
- Click New and add the path to the
bindirectory, e.g.:C:\micronaut\bin
- Click OK to save and close all dialog windows.
- Step 4 – Verify the installation: Open a new Command Prompt window (this is important—make sure to open a new one so the PATH changes take effect), and run:
mn --version
If installed correctly, this will display the installed Micronaut CLI version.
If you encounter any issues, ensure that there are no extra spaces in the PATH entry and that you’ve extracted the correct folder structure. While SDKMAN is not natively supported on Windows, advanced users running WSL (Windows Subsystem for Linux) can use SDKMAN inside a Linux shell. However, for most users, the manual installation method described above is sufficient and stable.
3. Conclusion
The Micronaut CLI is an essential productivity booster when developing with the Micronaut framework. On macOS, SDKMAN is the easiest and cleanest way to install it, while Windows users can set it up manually with just a few steps. Once installed, you’ll be ready to create microservices and applications efficiently using the power of the CLI.



