From 27d7e618fb5d26b1ca9f6530a21e0b8d7197c58d Mon Sep 17 00:00:00 2001
From: Greg DiCristofaro <gregd@basistech.com>
Date: Wed, 28 Jun 2023 11:13:01 -0400
Subject: [PATCH] fixes for mac

---
 Running_Linux_OSX.md                                 |  2 +-
 linux_macos_install_scripts/install_prereqs_macos.sh | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Running_Linux_OSX.md b/Running_Linux_OSX.md
index fbc4828c29..c35ca091e0 100644
--- a/Running_Linux_OSX.md
+++ b/Running_Linux_OSX.md
@@ -9,7 +9,7 @@ When installing on Debian-based Linux or macOS systems, there are three general
 
 # Installing The Sleuth Kit
 - **Linux**: Download the .deb file for the release you want to install from the [release section](https://github.com/sleuthkit/sleuthkit/releases).  Install The Sleuth Kit package from the repositories with the following command: `sudo apt update && sudo apt install /path/to/sleuthkit-version.deb`.
-- **macOS**: Ensure that for this session, your `JAVA_HOME` variable is set to the java 17 installation by running `export JAVA_HOME=$(/usr/libexec/java_home -v 17)/bin/java`.  Then, install The Sleuth Kit from source by running [`linux_macos_install_scripts/install_tsk_from_src.sh`](./linux_macos_install_scripts/install_tsk_from_src.sh), which will download, build, and install The Sleuth Kit.  It can be run as follows: `install_tsk_from_src.sh -p ~/src/sleuthkit -b sleuthkit-4.11.1`.  Make sure that your path to download source ends with "sleuthkit" as the last directory, and the release is the corresponding tag in the [repository](https://github.com/sleuthkit/sleuthkit).
+- **macOS**: Ensure that for this session, your `JAVA_HOME` variable is set to the java 17 installation by running `export JAVA_HOME=$(/usr/libexec/java_home -v 17)`.  Then, install The Sleuth Kit from source by running [`linux_macos_install_scripts/install_tsk_from_src.sh`](./linux_macos_install_scripts/install_tsk_from_src.sh), which will download, build, and install The Sleuth Kit.  It can be run as follows: `install_tsk_from_src.sh -p ~/src/sleuthkit -b sleuthkit-4.11.1`.  Make sure that your path to download source ends with "sleuthkit" as the last directory, and the release is the corresponding tag in the [repository](https://github.com/sleuthkit/sleuthkit).
 
 # Installing Autopsy
 - Download the Autopsy zip file from [repository releases](https://github.com/sleuthkit/autopsy/releases).  The file will be marked as "autopsy-&lt;release&gt;.zip" (i.e. "autopsy-4.19.2.zip").
diff --git a/linux_macos_install_scripts/install_prereqs_macos.sh b/linux_macos_install_scripts/install_prereqs_macos.sh
index de9b3b22a3..79dea276c2 100644
--- a/linux_macos_install_scripts/install_prereqs_macos.sh
+++ b/linux_macos_install_scripts/install_prereqs_macos.sh
@@ -8,5 +8,15 @@ then
     exit 1
 fi
 
+sudo ln -sfn $HOMEBREW_PREFIX/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk && \
+echo "export PATH=\"$HOMEBREW_PREFIX/opt/openjdk@17/bin:$PATH\"" >> ~/.zshrc && \
+source ~/.zshrc
+
+if [[ $? -ne 0 ]] 
+then 
+    echo "Unable to properly set up java env" >> /dev/stderr
+    exit 1
+fi
+
 java_path=$(/usr/libexec/java_home -v 17)
 echo "Java 17 path: $java_path"
\ No newline at end of file
-- 
GitLab