Magnolia CLI (latest version: ) is an npm package providing a command line interface (CLI) tool to set up and facilitate light development with Magnolia. You can use Magnolia CLI to quickly create a light module skeleton: the folders and files that form a Magnolia light module. This page provides instructions on how to install Magnolia CLI.
CLI support status
CLI v5 (released on October 16, 2024), is fully supported.
CLI v4 is in the Maintenance mode, where only security and critical issues will be addressed.
Since April 16, 2025, CLI v4 will receive no further updates.
After this date, you should use CLI v5.
CLI v2 and v3, while still available for installation through NPM, are no longer supported.
Light module minimal folder structure
Some Magnolia CLI commands may require that a minimal light module skeleton exists. For example, to run the create-app command, at least the following folder structure is expected to have been created:
Having Java installed is a prerequisite if you want to use the mgnl start CLI command to start Magnolia.
Magnolia needs at least a Java Runtime Environment (JRE) to run.
Check if there’s a version of Java already installed on your computer by opening the terminal or command prompt and typing java -version.
If the system reports a version number, Java is installed on your computer.
The commands are available in the shell on all directories.
The global configuration can be overridden on a project level using
the customize-local-config command.
The instructions that follow are based on the global npm package installation.
Which versions are available?
To display a list of released versions of Magnolia CLI, enter the following command in a shell:
npm view @magnolia/cli versionsCopy
Besides a version list, the following command shows additional information about the Magnolia CLI package:
npm view @magnolia/cliCopy
Installing the latest version
To install the latest version (globally), run the following command in a shell:
npm install @magnolia/cli -gCopy
Depending on your permissions and the Node.js installation location, you may have to execute the above command with root permissions. On Linux or OS-X, to run this command as root, use the following…
sudo npm install @magnolia/cli -gCopy
Installing a specific version
To install a specific version (globally), for example, 4.0.12, run the following command in a shell:
npm install @magnolia/cli@4.0.12 -gCopy
Depending on your permissions and the Node.js installation location, you may have to execute the above command with root permissions. On Linux or OS-X, to run this command as root, use the following…
sudo npm install @magnolia/cli@4.0.12 -gCopy
Installing the latest development version
The master branch on the Magnolia NPM CLI repo typically contains the version with the latest code.
You may alternatively check out the latest code and simply install it from source.
Please be aware that the official documentation does not cover the functionalities and changes of development versions.
To install the latest version from the master, do the following after checking out the latest code:
If you have already installed the CLI and want to update to the latest version, use:
npm update @magnolia/cli -gCopy
Testing the installation
To test the installation, run the following command in the shell:
mgnl helpCopy
Shell autocompletion
The Magnolia CLI package provides autocompletion for bash,C-shell and Windows PowerShell.
To install/enable autocompletion, use:
mgnl tab-completion installCopy
To uninstall it, use:
mgnl tab-completion uninstallCopy
A successful installation of autocompletion displays a list of files to which the tab-completion script has been appended.
To test the autocompletion installation, type mgnl and then successively hit the Tab key to scroll through the available commands.
On Windows, autocompletion is only available in PowerShell. If it does not work as expected after installation, you may have to change your execution policy. To do this, in PowerShell, run as Administrator:
Set-ExecutionPolicy RemoteSignedCopy
Uninstalling old autocompletion source
If you have already used autocompletion with Magnolia CLI version below 2.0, you may want to uninstall the old autocompletion manually. To do so, remove the following line in your bash settings.
This is typically found at ~/.profile or ~/.bashrc from your terminal.