Skip to content

Commit

Permalink
check if brew is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
tuky191 committed Oct 30, 2024
1 parent 2c6a418 commit e0767ae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docker/nexusctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ def check_docker_compose_version():
else:
print(f"Docker Compose version {major}.{minor} is sufficient.")

def check_brew_installed():
try:
subprocess.run(["brew", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
print("Brew is installed.")
except subprocess.CalledProcessError:
print("Brew is not installed. Please install Homebrew from https://brew.sh/ and try again.")
sys.exit(1)
except FileNotFoundError:
print("Brew is not installed. Please install Homebrew from https://brew.sh/ and try again.")
sys.exit(1)

def detect_gpu_and_set_env():
os_type = platform.system()
if os_type == "Windows":
Expand Down Expand Up @@ -104,6 +115,9 @@ def detect_gpu_and_set_env():
def start_ollama_serve():
os_type = platform.system()
if os_type == "Darwin":
# Check if brew is installed
check_brew_installed()

# Check if ollama is installed with brew
try:
if subprocess.run(["brew", "list", "ollama"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode != 0:
Expand Down

0 comments on commit e0767ae

Please sign in to comment.