Skip to content

Modules: /opt/homebrew should be in list of system paths on macOS - or not? #39046

@climbfuji

Description

@climbfuji

Steps to reproduce

On macOS, specifically on the M1 architecture, /opt/homebrew should be in the system paths:

diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py
index da6832e4dd..8d60f108e8 100644
--- a/lib/spack/spack/util/environment.py
+++ b/lib/spack/spack/util/environment.py
@@ -36,7 +36,7 @@
     ]
     SUFFIXES = []
 else:
-    SYSTEM_PATHS = ["/", "/usr", "/usr/local"]
+    SYSTEM_PATHS = ["/", "/usr", "/usr/local", "/opt/homebrew"]
     SUFFIXES = ["bin", "bin64", "include", "lib", "lib64"]

 SYSTEM_DIRS = [os.path.join(p, s) for s in SUFFIXES for p in SYSTEM_PATHS] + SYSTEM_PATHS

The reason is that if you have things like git-lfs, mysql installed there (which are a nightmare to build on macOS in spack), then the current spack develop code puts the path /opt/homebrew/bin in front of other paths when the spack-generated modules are loaded. If one has a python3 in /opt/homebrew/bin, then suddenly that python3 gets found again, even though the spack python3 module was loaded (first). The above change fixes that.

Error message

See description above

Information on your system

* **Spack:** 0.21.0.dev0 (98957cf32aa809e831bee4af2bf642e2bd038c04)
* **Python:** 3.8.9
* **Platform:** darwin-monterey-m1
* **Concretizer:** clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Labels

bugSomething isn't workingmodules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions