Questions tagged [environment-variables]
Environment variables are used to create shared settings that persist between invocations of applications. They are used to provide information such as paths to important directories, user information and other information programs need for common tasks.
107 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
1
answer
167
views
What is this path added by /etc/paths.d/10-pmk-global on macOS?
I was upgrading my development setup, and I found this path in my PATH variable: /opt/pmk/env/global/bin, and it's added by /etc/paths.d/10-pmk-global.
Usually, a system-related program would go in /...
0
votes
0
answers
49
views
What is the location of system PATH and other environment variables in macOS 26?
There seems to be a consensus that the PATH for macOS (any version) is some value set (exclusively) in /etc/paths and user-maintained shell scripts (notably /etc/profile and ~/.profile as well as ...
3
votes
1
answer
635
views
MACHTYPE environment variable on ARM
I am on an M3 Pro, MacOS 14.2. When I try echo $MACHTYPE (in a default -zsh shell) the output is x86_64, whereas uname -mp returns arm64 arm. Zsh docs say that MACHTYPE should be "the machine ...
0
votes
0
answers
113
views
TMPDIR is not set in a new shell when using su
On a Mac running macOS 13.5, $TMPDIR is not set in a new shell. This is a multi-user machine, and it is unset for all users that are sued to, causing multiple issues since libraries may default to /...
7
votes
0
answers
3k
views
How to set PATH for all applications on a per-user basis?
I'm looking for a way to set the PATH environment variable for all applications that I (and only I) run under macOS (version 14 / Sonoma at the time of writing.) That sounds like it ought to be ...
0
votes
1
answer
401
views
No $PATH file in my home folder on my Ventura 13.5.2? [duplicate]
I am using zsh and I wanted to modify the $PATH variable permanently. I can't seem to find either .zshrc or .zsh_profile on my computer -- I tried searching in Finder with enabled hidden files.
I ...
2
votes
0
answers
200
views
Set Environment Variable for specific application that starts at login
I need to set an env var for an app on MacOs. This is an app that I want to run on startup (currently via Login Items). I can set the env var as a LaunchAgent plist file with the RunAtLoad key set ...
3
votes
2
answers
309
views
Can I use the output of a shell script to set env vars from launchd?
I'm using launchd to set an env var at startup using launchctl setenv.
The script works fine when the variable is hardcoded in it, but unfortunately I need to get this variable dynamically at startup ...
1
vote
1
answer
3k
views
How to unset a variable which is previously set somewhere in Mac OS I don't know?
I have a variable set exactly like this:
export VARIABLE_NAME=VARIABLE_VALUE
I thought it would be in ~/.zshrc or bash_profile but it is seen in none of those. I am now struggling to understand where ...
3
votes
3
answers
2k
views
Automator run shell script does not know my PATH?
When I use the "run shell script" in automator, and do, for example
say $PATH
it then tells me the PATH. But the path is incomplete. Some items I have in $PATH when using the terminal (zsh) ...
1
vote
2
answers
5k
views
Set environment variable for the whole GUI session (Aka without using `~/.zshenv`)
(EDIT OF 06/02/2023 : Previous title was
Variables set using launchctl setenv aren't part of environment in Mac OS 12 )
I'm a daily Linux user and decided to try Mac recently.
I have a Macbook pro 13&...
2
votes
1
answer
86
views
sudo -E -s does not preserve ZDOTDIR
Running zsh on macOS Ventura
→ With
sudo --preserve-env -s the environment variable ZDOTDIR is not preserved but all the others are.
→ With sudo --preserve-env=ZDOTDIR -s the variable ZDOTDIR is ...
0
votes
0
answers
495
views
X11/XQuartz 'Couldn't find per display information' on Mac Book Pro 2019, OS Monterey
I am trying to run mbsystem (a command-line tool for geodata processing) that for some commands uses a GUI based interface (e.g. if i type 'mbedit' in the command line, a window should open where i ...
1
vote
0
answers
219
views
Why is LANG environment variable wrong in shell?
When I start a Terminal (in Monterey 12.2.1) my LANG is sv_SE.UTF-8, which is fine.
When I start a shell, or any other sub-process that reads environment, from GUI Emacs it is set to LANG="en_SE....
11
votes
2
answers
10k
views
What's the correct file to store environmental variables for zsh?
I'm a bit confused as to how all of this works. Seemingly every tutorial tells me something different. So far there's about 4 different files I can add environmental variables to:
.zshrc
.profile
....
user avatar
user449171