Installing Liquibase Command Line for Linux/Unix/Mac


Once you have downloaded the Liquibase-Version#-bin.tar.gz file, create a local directory on your computer.

Example: /usr/apps/Liquibase-<version>-bin

Next, add the directory to your PATH. To add the directory to your PATH:

  1. Open the Terminal or Linux Command Line.
  2. Run the following command:
export PATH=$PATH:/path/to/Liquibase-<version>-bin

Note: This command will not permanently update your PATH after the termination of your session. To update your PATH permanently, run the following command: source ~/.profile or source ~/.bashrc.

  1. Restart your command line.

Note: For macOS users, there is another way to set path using Terminal in Default mode.
To set path, you can run: sudo nano /etc/paths and then append the path /path/to/Liquibase-<version>-bin at the end of the file. Select Ctrl+x and y for yes to save the file and restart your Terminal. Refer to the Downloading & Installing Liquibase on MacOS video for more information.

Verifying

Verification is an essential aspect of the Liquibase installation process, and there are three things you need to check:

  1. The Liquibase folder was correctly added to your PATH.
  2. Java is installed on your system.
  3. The Liquibase help command can be run.

Verification #1: Check your PATH

To verify that you have correctly added the Liquibase folder to your PATHs, type env in your Terminal or Linux Command Line to display all your available PATHs.

Verification #2: Check for Java installation

For Liquibase to run correctly, Java must be installed on your Linux, Mac, or Unix machine. To verify that Java is installed on your computer:

  1. Open your Terminal or Linux Command Line.
  2. In the Command Prompt window, type: java -version

If you see the error message: "-bash: java: command not found", then you need to either install Java, or you need to add the location of the Java executable to your PATH. To install Java on your computer:

  1. Go to https://www.oracle.com/java/technologies/javase-downloads.html and install Java.
  2. Add the location of the Java executable to your PATH:
  • Open the Terminal or Linux Command Line.

  • Run the following command:
  • export PATH=$PATH:/usr/apps/Liquibase/<JDK_Directory>/bin

    Note: This command will not permanently update your PATH. To permanently update your PATH, edit your ~/.profile or ~/.bashrc file, add the export command as it is shown earlier in the guide, and then run either source ~/.profile or source ~/.bashrc.

Verification #3: Run the Liquibase help command

Another way to verify that you installed Liquibase correctly on your computer is to run the Liquibase help command. To run the command:

  1. Open your Terminal or Linux Command Line.
  2. Run the following: liquibase --help

Troubleshooting

  • If you cannot run the Liquibase help command, verify that you have correctly installed Java. Also, ensure that the Liquibase folder you downloaded is set to your PATHs.
  • If you have installed Java, however, you are still receiving an error, add Java to your PATHs using the steps provided in the Verifying section.