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
22 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
57 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
23 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 /...
2
votes
1answer
67 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: # ...
1
vote
3answers
2k 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
35 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 ...
3
votes
1answer
5k 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 ...
2
votes
1answer
611 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
264 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
514 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
115 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
1k 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="$...
1
vote
0answers
58 views

Applescript > Passing variable

I using different script, on script is getting some infos and variables, e.g name , phone number etc... which I then use with different script. For now, I'm saving to a plist file and get the ...
3
votes
1answer
410 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
21 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-...
2
votes
1answer
1k 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
259 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
310 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. ...
4
votes
1answer
4k 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
689 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
1k 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 ...
5
votes
2answers
12k 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
627 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
591 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
204 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
129 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 ...
1
vote
0answers
66 views

Set language-related environment vars for _all_ processes (not just inside Terminal)

On my somewhat creaky MBP running Yosemite, I find that the POSIX environment variables for controlling the locale (LANG and LC_*) are properly set inside Terminal windows... $ printenv | grep -E '^(...
7
votes
2answers
3k views

Set PATH variable so that it is detected in all applications, even outside terminal. (El Captain)

My ~/etc/path looks as follows: /usr/local/bin /usr/bin /bin /usr/sbin /sbin The Problem: When I type echo $PATH into terminal, I get back: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin And this ...
3
votes
2answers
7k views

X11 applications don't open after XQuartz update (OS X 10.10.4)

I updated X11 by installing the most recent XQuartz package, 2.7.9. Now, when opening an application that is supported by X11 (e.g., emacs), my terminal throws an error (while X11 starts in the ...
1
vote
0answers
462 views

How do items in the 'Applications' folder get on the path?

How does the 'Applications' folder get on the path? For example, I installed Chrome browser into the Applications folder on my Mac and I can type chrome at a bash shell prompt to start it. Now, if I ...
0
votes
2answers
107 views

Is it possible to set the JAVA_HOME env in El Captitan?

I am unable to set the JAVA_HOME environment variable osx. I added the following line to my .bash_profile export JAVA_HOME=`/usr/libexec/java_home` and sourced it afterwards; yet when I printenv or ...
1
vote
1answer
999 views

How to change JAVA_HOME with a Bash script

I have created a Bash script with the following line: export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home" 2> bash_errors.txt I have also made the file executable ...
4
votes
0answers
5k views

Setting system-wide environment variables in El Capitan [closed]

I was using the method described in this post to invoke "launchctl setenv" to set environment variables globally. I have just upgraded to OS X 10.11 "El Capitan," and now I see that the launchctl ...
11
votes
1answer
5k views

Unable to set DYLD_FALLBACK_LIBRARY_PATH in shell on OSX 10.11.1

In shell scripts used for unit testing with dynamic libraries in a directory other than the typical @rpath, I have previously been able to set DYLD_FALLBACK_LIBRARY_PATH to set the directory ...
1
vote
1answer
186 views

Setting locale via launch daemon - downside to this approach?

I have the same problem as in this post here that R started in ESS / Emacs can not set the locales: R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 The R Foundation for Statistical ...
2
votes
0answers
921 views

Environment variable for a user's Documents folder?

When I'm developing with Xcode or maybe using tools like gulp or grunt I notice that the tools try to access resources from an incorrect path. I've observed the problem in more that one program so ...
1
vote
1answer
3k views

Shell set environment variables for command

I want to run a program in Terminal and set its environment variables. According to my research one can do this using: VARIABLE="value" VARIABLE2="value2" run_program Now I'd like to set a variety ...
27
votes
6answers
94k views

How to add MySQL to $PATH variable to resolve “mysql: command not found”?

I installed MySQL on my Mac, and now I would like to add it to my $PATH variable. I want to be able to type mysql anywhere. I tried adding the following to my .profile file: export PATH=${PATH}/usr/...
6
votes
1answer
1k views

OS X Yosemite permanent environement variables

Since I upgraded to OS X Yosemite I do have massive problems with environment variables that I really, really NEED for development of some projects. The Problems is: Every time I install some kind ...
2
votes
1answer
133 views

How do I create terminal session independent env vars on OS 10.10?

I read Mortimer's answer here https://stackoverflow.com/questions/25385934/setting-environment-variables-via-launchd-conf-no-longer-works-in-os-x-yosemite and added this file in /Users/MyName/Library/...
4
votes
1answer
5k views

After Yosemite, can't print; CUPS error_log: “/bin/bash: gs: command not found”

My printer stopped working since I upgraded to Yosemite. The print queue window says only "Stopped - 'Filter' failed". From /var/log/cups/error_log: ... D [28/Oct/2014:21:46:49 -0700] [Job 4] PID ...
16
votes
3answers
26k views

In OSX Yosemite, why can I set many environment variables for GUI apps, but cannot set the specific variable PATH

After I had sorted out OSX' PATH issues up to the Mavericks release, the problems come back in Yosemite!!! So I want to mimic the old launch.conf feature in the new Mac OSX 10.10 Yosemite release, ...
0
votes
1answer
638 views

How can I set a user-specific environment variable that includes a space character?

I'd like to add an environment variable for a specific account where the variable has a space. It seems that editing .bash_profile like below doesn't work: export ENV_VAR=“/Applications/Android ...
0
votes
1answer
1k views

Making items added to paths via paths.d show up everywhere under Mavericks

I'd like to set the path under OS X Mavericks so that the setting shows up everywhere (e.g., in .apps and in Darwin shells). There's plenty of discussion out there about how to set environment ...
5
votes
1answer
3k views

Is $HOME/.MacOSX/environment.plist still used in OS X 10.9.2 for setting global environment variables?

Is $HOME/.MacOSX/environment.plist still recognized/used in OS X 10.9.2 for setting global environment variables? Apple's official documentation does not say explicitly it's deprecated, AFACT: https:...
2
votes
2answers
1k views

R shiny crash on loading examples (__cxa_guard_acquire detected deadlock) change default C++ standard library

I wanted to try out R Shiny but whenever I try any of the examples my R crashes: > require(shiny) Loading required package: shiny > runExample("01_hello") libc++abi.dylib: __cxa_guard_acquire ...
1
vote
1answer
2k views

Dynamically setting HOME environment variable in a launchd script?

Continue from this topic, I ended up with: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0....
35
votes
6answers
61k views

How to set system-wide environment variables on OS X Mavericks

We used to use /etc/environment to set system-wide environment variables on Mountain Lion. However, it seems this file is no longer read. Ideally the solution should apply to all users, and we need ...
63
votes
7answers
314k views

How do I set environment variables on OS X?

I have always difficulties setting the Environment variables in OS X like JAVA_HOME, M2_HOME or PATH. How to set these on OS X Mavericks? I did some research but the answers I've found didn't really ...