How To Install Spring Boot CLI On Mac, Linux And Windows

Spring boot CLI is a spring command-line tool that can help you develop spring applications quickly and easily. It utilizes spring’s start dependence and automation configuration features, then developers can focus on the business logic code, does not need to care about the project jars dependency and configuration. This article will tell you how to install spring boot CLI on macOS, Linux, and Windows.

1. Install Spring Boot CLI Manually.

  1. This method is useful for both macOS, Linux, and Windows.
  2. Go to the spring boot getting started and installation page and download spring-boot-cli-2.1.0.BUILD-SNAPSHOT-bin.zip.
  3. Unzip the downloaded file to a local folder. You can find there is a bin folder under it. There are two executable files, one is spring( for Mac or Linux ) the other is spring.bat( for Windows ).
  4. Open a terminal and execute the below command to add the above bin folder to the current system environment variable PATH‘s value.
    # Go to user home directory.
    $ cd ~
    $ ls -l .bash_profile
    # Edit .bash_profile file.
    $ vim .bash_profile
    # Add spring boot CLI bin folder to system environment variable PATH value and save .bash_profile file.
    $ export PATH="/Users/zhaosong/Downloads/spring-2.1.0.BUILD-SNAPSHOT/bin:$PATH" 
    # Make above change effective.
    $ source .bash_profile
  5. To verify spring boot CLI installation correctly, run spring --version in terminal.
    localhost:~ $ spring --version
    Spring CLI v2.0.2.RELEASE
    
  6. Run spring boot CLI shell. You can run commands in the spring boot CLI shell, you can execute a lot of CLI commands in the shell, and press the TAB key to auto-complete CLI shell commands.
    $spring shell

2. Install Spring Boot CLI On MacOS Use HomeBrew.

  1. Ensure HomeBrew is installed in your macOS.
    localhost:~ $ brew -v
    Homebrew 1.7.4
    Homebrew/homebrew-core (git revision cc23; last commit 2018-09-11)
  2. Install pivotal’s tap to add additional software ( such as spring boot CLI ) on Mac.
    localhost:~ $ brew tap pivotal/tap
    Updating Homebrew...
    ==> Tapping pivotal/tap
    Cloning into '/usr/local/Homebrew/Library/Taps/pivotal/homebrew-tap'...
    ......
  3. Install spring boot CLI use HomeBrew.
    localhost:~$ brew install springboot
    Updating Homebrew...
  4. Spring boot will be installed in the /usr/local/bin folder.
  5. Then you can run spring --version or spring shell to run spring boot CLI commands.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.