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.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Where application bundles get their environment variables from?

A user of my (Python based) app reports that they can't open it in regular way (via double clicking the icon in Finder) -- nothing just happens. When they run it from Terminal, they get an error (from ...
0
votes
0answers
13 views

Unity Fails to Launch: Package Manager Error most likely due to a proxy or firewall configuration

My Mac (v10.15.5) cannot launch Unity regardless of the versions used, and attached is the error message saying it is about Package Manager: Unity Package Manager Error Could not establish a ...
3
votes
1answer
56 views

Script menu: how to reference user-path utilities (PATH / environment is missing)

Summary How can I execute scripts from the system-wide Script menu with a normal environment? It seems the environment is not being setup at all. Scripts that are run from the script menu can find and ...
4
votes
1answer
659 views

macOS Big Sur - set env vars for GUI apps?

I followed many methods on Ask Different as to how to change the $PATH environmental variable for GUI apps. Some of the methods may work for pre-Catalina macOS, some may work for Catalina, but none of ...
1
vote
4answers
165 views

Automate workspace setup

I'm a software developer and I often have to switch between different projects, each with its own environment setup. Some actions I have to do each time include: creating ssh tunnels connecting ...
1
vote
0answers
100 views

Launchctl setenv in Terminal.app vs iTerm

If I use launchctl setenv FOO BAR in Terminal.app, after closing and reopening the app, the variable FOO is correctly set. If I do the same thing in iTerm, nothing happens. Why?
0
votes
0answers
399 views

Setting global variables with macOS Catalina

I use the environment.plist method to setup global variables in macOS. I have this template in ~/Library/LaunchAgents <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ...
1
vote
1answer
89 views

Run script at sunrise time

I'm trying to set my hackintosh pc to turn on at every sunrise and to run iTunes as the macOS boots up using bash or AppleScript without 3rd-party apps. I reached the point in my script when I need ...
4
votes
2answers
133 views

Ran export TMPDIR=~/tmp/ and it broke my node app, can I revert the tmp folder to the default folder?

Hey I ran export TMPDIR=~/tmp/ and it changed my temp folder. I was trying to get a Go backend working and an article suggested it. I was a little trigger happy and now this is causing issues with a ...
1
vote
1answer
58 views

Why do my environment variables keep getting wiped out in Mac OS Catalina?

I am currently using MacOS Catalina, and every time my computer boots up from having shut down the environment variables get wiped out. I literally have to manually run export FOO=bar each time my ...
2
votes
0answers
174 views

How to set an environment variable working on both bash and GUI?

Considering the current version of macOS being Catalina, I am looking for a way to set permanently an environment variable for both: bash and GUI applications. I have searched online for a while, but ...
0
votes
2answers
2k views

Setting GUI Visible Environment Variables with OS Catalina

I need to set a number of Environment variables that can be seen by GUI apps (i.e. Xcode). When running from a terminal this is trivial and is simply a case of adding a. number of export commands to ...
15
votes
1answer
10k views

ZSH: .zprofile, .zshrc, .zlogin - What goes where?

Now that I've upgraded to Catalina and I am using the new ZSH shell, I've noticed that ~/.bash_profile has been replaced with ~/.zprofile and since installing iTerm2 shell integration, it added a ~/....
0
votes
0answers
21 views

How do I set a system wide environment variable on macOS?

I have a Java web application that runs on Tomcat, and the web application attempts to read a configuration filename from a system environment variable (ex. MYAPP_CONFIG_FILE). How do I set such a ...
0
votes
2answers
65 views

How do I use ls command with a variable for a directory in zsh?

I set a variable named $G2_HW_sci. This is the output with echo. user@192 SS % echo $G2_HW_sci ~/Documents/trabalho/SS/G2/science/homework/student_work/ Then I tried to ...
0
votes
0answers
49 views

Where does zsh get the values of LANG & LC_CTYPE if it is not in .zshrc?

Where does zsh get the values of LANG & LC_CTYPE if it is not in .zshrc ? I check my ~/.zshrc and it didn't set them, but if I run printenv I find they were both set, although not the values I ...
1
vote
1answer
33 views

environment variable edit error

I have been trying to edit my environment variables. I referred to the sites but its not working. I should mention that I am very new to Mac and I'm using it because my workplace has it. When I enter ...
1
vote
1answer
726 views

Using Node.js without admin rights - sh: node: command not found

I've been following this guide (https://theshravan.net/blog/how-to-use-node-and-npm-without-installation-or-admin-rights/) to try to use Node.js on my work computer. The guide is for windows but most ...
0
votes
2answers
553 views

How to use Node.js without admin rights on a mac?

I'm trying to use Node.js on my work computer but I don't have admin rights. I'm wondering how I can install Node.js on mac without having admin rights. I found a tutorial, which is for Windows but ...
0
votes
2answers
398 views

Who sets the BROWSER environment variable in macOS?

I noticed I have BROWSER set to open in my environment variables, but I can't figure out where it gets set by the system. When I run env I get this output: USER=xxx PATH=xxx LOGNAME=xxx ...
0
votes
1answer
1k views

environment variable not showing after set

I am trying to set permanent environmental variable in my mac machine I have tried following steps till now - vi ~/.bash_profile adding my variable export JAVA_HOME=/Library/Java/...
5
votes
1answer
73 views

Bash: Elegant ways to use multiple variables for shortening long strings?

I am aware of dockutil in homebrew but, I am trying to run a bash script that automatically adds dock icons to the dock on a fresh user account. dockutil has been uncooperative on fresh out of the box ...
2
votes
2answers
189 views

Escape space character in pathfile?

I'm trying to set an environment variable for Anki's media folder, in .bash_profile. The line is export ANKI_MEDIA='/Users/<username>/Library/Application Support/Anki2/me/collection.media'. ...
2
votes
1answer
171 views

Where can I see modifications made to the PATH environment variable by the Go installer

I've identified several changes to the PATH variable in Bash that aren't listed in e.g. /etc/profile, ~/.profile, .bash_profile, ~/.bashrc. The following snippet from the Go installation page ...
0
votes
0answers
75 views

Build without requiring users to set LD_LIBRARY_PATH?

I'm following this guide on how to build NumPy with Intel MKL on a macOS (I'm on Mojave 10.14.5), and after installing Intel's MKL library, the guide tells me to set LD_LIBRARY_PATH: export ...
1
vote
2answers
178 views

sub Applescript with Global / property

I'll like to run a second applescript with variable from the first Applescript. If I do a first script to property myName : "Kevin" And a second script with : set remoteScript to (load script "/...
0
votes
0answers
29 views

dyld monitors DYLD_ variables behind the scenes [duplicate]

If I invoke DYLD_X=foo /bin/bash -c 'echo "<$DYLD_X>"' the output is <> while MY_VAR=bar /bin/bash -c 'echo "<$MY_VAR>"' outputs <bar> Switching to Bash 5: DYLD_X=foo /...
6
votes
1answer
353 views

How do I use my GPG agent for SSH everywhere?

On my system, I'm trying to set up SSH authentication through my GPG agent (installed via brew). So far, I have this working in my terminal thanks to adding the following lines to ~/.profile: # ...
26
votes
5answers
58k views

How to add permanent environment variable in zsh

I have been scouring the internet, and cannot seem to find a solution to permanently adding an environment variable, specifically when my OS is macOS Mojave (10.14). It seems there are a lot of ...
1
vote
1answer
57 views

change default editor for command line tasks?

I want to create a cron job. Launching a terminal window, and entering crontab -e opens my current crontab, but opens it in the editor vi. I would prefer to use the nano editor. How do I configure ...
4
votes
1answer
11k views

Mojave (10.14) setting environment variables

There are other questions and topics just like this but I can not find anything that is specific to 10.14 Mojave. I have tried the ~/Library/LaunchAgents/environment.plist method and I have tried to ...
3
votes
1answer
1k views

Create and set environment variable in MacOSX

I want to set some environment variables in my Mac. I was hoping to do that by creating a small bash script file inside paths.d and then restart my machine. Is this the correct way to add ...
3
votes
1answer
513 views

Open Terminal Window with Predefined Environment Variables (Including `PATH`)

I'm trying to create a .command file which will open a terminal window with predefined Environment Variables (Including PATH). I tried this: #!/bin/bash # Adding CMake to Path export PATH=$PATH:/...
2
votes
3answers
876 views

How exactly is PATH calculated?

I've read a dozen different answers and talked to a bunch of people and am having difficulty understanding how PATH is calculated in different scenarios. Specifically I'm thinking of How exactly is ...
0
votes
1answer
326 views

Removing directories from PATH

I am trying to run rkhunter, but it is giving me this output: stack/security/rkhunter-1.4.6 ➜ sudo rkhunter --check Password: Invalid BINDIR configuration option: Invalid directory found: ~/.dotnet/...
4
votes
1answer
4k views

Add Environment Variable to PATH

I am new to the Apple "eco system" and I am trying to setup my environment variables for local development. Here is what I have in my ~/.bash_profile (simplified for brevity): export PATH="$...
3
votes
1answer
475 views

Is it possible to remove the $ from an environment variable?

I'm on Mac and have just created an environment variable inside the .bash_profile directory, it works fine when I run: $variable_name I just want the know why the dollar sign is there and if it is ...
2
votes
0answers
29 views

Launching an application via Finder and enabling env variables for logging

I want to launch an application via Finder in a current Mac OS X. I want to enable some logging modules, which can be set by export NAME=etc on the console, but I want to include them in the Finder-...
3
votes
1answer
3k views

Missing /usr/local/sbin directory in the /etc/paths file

Why doesn’t the /etc/paths file include the /usr/local/sbin directory on macOS? $ cat /etc/paths /usr/local/bin /usr/bin /bin /usr/sbin /sbin I would have expected: $ cat /etc/paths /usr/local/bin /...
1
vote
2answers
274 views

Environment variable for Apple Shake 4.1

Where is Shake's environment variable located in macOS allowing to launch Shake.app via Terminal session in High Sierra? There's no Shake's variables in ~/.bash_profile, /etc/profile and /etc/bashrc....
0
votes
1answer
367 views

/etc/profile not being sourced for login shells

The -l flag to sh is supposed to source the contents of /etc/profile and other profile scripts like ~/.profile, which generally provide the initial set of environment variables for a login session. ...
7
votes
1answer
6k views

Setting variables in environment.plist

I've been trying to come to terms with how to set environment variables needed by launched applications in Sierra, but I'm puzzled. Following various bits of advice found online, I created a file ~/...
2
votes
1answer
1k views

macOS no longer recognizes environment.plist

I need to set up environment variables for Pixar RenderMan Pro Server in macOS 10.13. Yosemite, El Capitan, Sierra and High Sierra no longer recognize environment.plist located in a hidden .MacOSX ...
1
vote
1answer
1k views

Safe to change TMPDIR?

I recently installed Open MPI, and it's complaining PMIx has detected a temporary directory name that results in a path that is too long for the Unix domain socket: Temp dir: /var/folders/**/********...
1
vote
0answers
2k views

Environment var (LD_LIBRARY_PATH) weirdly hidden under bash on Mac [duplicate]

Here is a brief, self-explanatory bash session on Linux: $ env | grep LD_LIBRARY_PATH $ export LD_LIBRARY_PATH=foo $ env | grep LD_LIBRARY_PATH LD_LIBRARY_PATH=foo $ echo $LD_LIBRARY_PATH foo Here ...
12
votes
2answers
29k views

How do I add a directory to PATH when using `zsh` in Sierra

In macOS Sierra 10.12.x, what is the modern way to add a directory to the PATH environment variable that can work across shells or specifically work with zsh shell (I switched from the default bash to ...
1
vote
1answer
852 views

Set environment variable for applications on startup

How do you set an environment variable on startup so that it can be used in applications? For example, ATOM_HOME is used by Atom.
0
votes
1answer
596 views

Command found with `which` at the new paths but still tries to run from the old path

I have installed new version of npm in the custom directory .npm-global/bin and removed it from /usr/local/bin. The new path is declared: PATH=/usr/local/bin:./node_modules/.bin:/Users/dmitrizaitsev/....
0
votes
1answer
269 views

Interaction between profiles of Terminal.app and environment variables

I wonder if and how it is possible to set shell environment variables based on the Terminal.app profile. More specifically, I would like to use a coloured prompt in Terminal.app or iTerm2.app in Mac ...
2
votes
2answers
140 views

Making ~/.bashrc function callable to set up an environment

I have an installed app lets call it my_app that I wish to be able to call from the command line. It is located in /Applications/my_app.app/Contents/Resources. So what I was hoping to do was to have ...