private static boolean shouldLoadShellEnv() {
    if (!SystemInfoRt.isMac) {
      return false;
    }

    // The method is called too early when the IDE starts up; at this point, the registry values have not been loaded yet from the service.
    // Using a system property is a good alternative.
    if (!Boolean.parseBoolean(System.getProperty("ij.load.shell.env", "true"))) {
      LOG.info("loading shell env is turned off");
      return false;
    }

    // On macOS, a login shell session is not run when a user logs in, so 'SHLVL > 0' likely means that the IDE is started from a terminal.
    String shLvl = System.getenv(SHLVL);
    try {
      if (shLvl != null && Integer.parseInt(shLvl) > 0) {
        LOG.info("loading shell env is skipped: IDE has been launched from a terminal (" + SHLVL + '=' + shLvl + ')');
        return false;
      }
    }
    catch (NumberFormatException e) {
      LOG.info("loading shell env is skipped: IDE has been launched with malformed " + SHLVL + '=' + shLvl);
      return false;
    }

    return true;
  }
private static boolean shouldLoadShellEnv()