Set $SPLUNK_HOME

The SPLUNK_HOME environment variable specifies where your instance of Splunk is installed. Setting this variable makes it easier to navigate to Splunk's installation directory in a terminal or command prompt. Some apps rely on this variable. The Splunk documentation refers to this location in file paths as $SPLUNK_HOME.

Splunk Enterprise may set this variable during the installation process. For instance, the DMG installer for Mac OS X sets this variable. This topic describes how to check if SPLUNK_HOME is set, and how to set it if needed.

Determine whether the SPLUNK_HOME environment variable is set

On *nix:

  1. Open a terminal window.
  2. Enter the following command:
  3. echo $SPLUNK_HOME

    If you see "/Applications/Splunk" or similar, SPLUNK_HOME has been set.

On Windows:

  1. Open a command prompt.
  2. Enter the following command:
  3. echo %$SPLUNK_HOME%

    If you see "C:\Program Files\Splunk" or similar, SPLUNK_HOME has been set.

Set the SPLUNK_HOME environment variable

The value of SPLUNK_HOME should be the directory of your Splunk installation.

On *nix:

  1. In a terminal window, enter the following command:
  2. touch .profile
  3. Exit the terminal window.
  4. In a new terminal window, enter the following command:
  5. echo export $SPLUNK_HOME=your_Splunk_directory >> .profile

    For example, to target the default install location, the command would be:

    export $SPLUNK_HOME=/Applications/Splunk
  6. Close the terminal window.
  7. To test that this procedure worked, enter the following command in a new terminal window:
  8. echo $SPLUNK_HOME

    The echo should return the Splunk directory you entered.

On Windows:

  1. In a command window, enter the following command:
  2. setx $SPLUNK_HOME your_Splunk_directory

    For example, to target the default install location, the command would be:

    setx $SPLUNK_HOME "C:\Program Files\Splunk"
  3. Close the command window.
  4. To test that this procedure worked, enter the following command in a new command window:
  5. echo %$SPLUNK_HOME%

    The echo should return the Splunk directory you entered.