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
4 votes
1 answer
5k 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="$...
Georgi Stoimenov's user avatar
3 votes
1 answer
760 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 ...
LuckyPants's user avatar
3 votes
0 answers
193 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-...
jdoe's user avatar
  • 41
3 votes
1 answer
4k 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 /...
Géry Ogam's user avatar
1 vote
2 answers
291 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....
user avatar
0 votes
1 answer
551 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. ...
Score_Under's user avatar
12 votes
1 answer
11k 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 ~/...
Sean's user avatar
  • 223
2 votes
1 answer
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 ...
user avatar
3 votes
1 answer
2k 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/**/********...
NoethersOneRing's user avatar
1 vote
0 answers
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 ...
Steve Waldman's user avatar
23 votes
5 answers
90k 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 ...
Basil Bourque's user avatar
1 vote
1 answer
1k 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.
0az's user avatar
  • 299
0 votes
1 answer
608 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/....
Dmitri Zaitsev's user avatar
0 votes
1 answer
616 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 ...
Alexey's user avatar
  • 201
2 votes
2 answers
191 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 ...
Dipole's user avatar
  • 173
2 votes
0 answers
94 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 '^(...
zwol's user avatar
  • 121
11 votes
2 answers
4k 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 ...
FabulousGlobe's user avatar
3 votes
2 answers
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 ...
Sebastian Sulger's user avatar
1 vote
0 answers
645 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 ...
djangofan's user avatar
  • 255
0 votes
2 answers
154 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 ...
Dark Star1's user avatar
1 vote
1 answer
2k 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 ...
Roy Hinkley's user avatar
4 votes
0 answers
6k 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 ...
Philip Keller's user avatar
16 votes
1 answer
8k 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 ...
Guy's user avatar
  • 161
1 vote
1 answer
280 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 ...
Rainer's user avatar
  • 1,686
2 votes
0 answers
2k 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 ...
aghaux's user avatar
  • 141
1 vote
2 answers
9k 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 ...
Julian F. Weinert's user avatar
46 votes
8 answers
168k 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/...
JNevens's user avatar
  • 639
6 votes
1 answer
2k 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 ...
byemute's user avatar
  • 163
2 votes
1 answer
225 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/...
MarcusH's user avatar
  • 131
4 votes
1 answer
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 ...
Trevor Dixon's user avatar
16 votes
3 answers
27k 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, ...
halloleo's user avatar
  • 1,295
0 votes
1 answer
788 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 ...
andrewb's user avatar
  • 152
1 vote
1 answer
2k 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 ...
kuzzooroo's user avatar
  • 705
5 votes
1 answer
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:...
Meng Lu's user avatar
  • 231
3 votes
2 answers
2k 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 ...
crogg01's user avatar
  • 133
1 vote
1 answer
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....
quanta's user avatar
  • 265
42 votes
7 answers
84k views

How to set system-wide environment variables

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 it ...
joerick's user avatar
  • 808
163 votes
12 answers
760k 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 ...
akcasoy's user avatar
  • 1,859
48 votes
8 answers
95k views

Setting the system-wide PATH environment variable in Mavericks

In previous OS versions one could set the system-wide PATH environment variable in /etc/launchd.conf to make it available for all apps (not just the command line). In Mavericks this appears to be no ...
Tom's user avatar
  • 583
2 votes
2 answers
2k views

Setting up environment variables for GUI apps?

Transitioning from Windows to the Mac. In Windows, I had a lot of environmental variables set-up that I used to speed up my work. Thinks like DEVDIR=C:\WORKDOCS\DOCS_jaravj\PROJ\dev DOCDIR=C:\...
JJarava's user avatar
  • 1,246
3 votes
2 answers
25k views

Changing the $HOME environment variable in terminal on mac 10.8

To be clear im not looking for a workaround that will execute a change directory command on startup. I want to alter the $HOME env var so that tilde commands work and so that entering a 'cd' command ...
Andrew's user avatar
  • 53
9 votes
1 answer
6k views

How to use environment variables in applescript

I'd like to use my environment variables, which were defined in my environment.plist file, in my applescript. How do I do that, for instance: log "Glassfish Home: " & AS_HOME Where AS_HOME is ...
Henrique Ordine's user avatar
2 votes
2 answers
1k views

Can I have color ls output automatically if my TERM is "xterm-256color"?

Can I have automatic color output for ls if my TERM environment variable is set to xterm-256color?
CyberSkull's user avatar
  • 2,557
0 votes
1 answer
515 views

Set environment variable for the process before startup [duplicate]

I have the following situation: I have Mac OS bundle with application which uses some 3rd party dylib's and those dylib's depend on some env variable, let's name it ENV_VAR. I want to set ENV_VAR to ...
ixSci's user avatar
  • 103
4 votes
1 answer
653 views

In Mountain Lion why do remote shells via ssh do NOT inherit the environment of the launchd parent process?

When logging in to my Mountain Lion Mac remotely via ssh I do not get the same PATH variable as when I open a shell locally: The local shell inherits its environment as expected from launchd and ...
halloleo's user avatar
  • 1,295
9 votes
3 answers
8k views

In Mountain Lion how do I set, in one place, the PATH environment variable for all newly launched applications?

On Ask Different there are many questions regarding the PATH environment variable and how to set it for applications launched by a shell, by spotlight or via the finder (typical questions: How to set ...
halloleo's user avatar
  • 1,295
7 votes
1 answer
919 views

/etc/launchd.conf setenv value containing whitespace

In my /etc/launchd.conf file, I added these lines in an effort to figure out exactly how to create globally scoped environment variables whose values contain whitespace. setenv foo1 123456 setenv ...
Steve's user avatar
  • 354
9 votes
2 answers
4k views

Problems installing Ruby versions via RVM in Mountain Lion

So I recently joined the Mac world and bought a MacBook - which I love, by the way. I'm having some trouble getting all my dev tools up setup properly and am not quite 100% familiar with the ...
brennebeck's user avatar
5 votes
1 answer
10k views

Defining environment variables with launchd/launchctl

There are different solutions regarding the definition of environment variables that are stored in the launchd process, namely over at StackOverflow and Superuser. How do these solutions differ?
Percival Ulysses's user avatar
8 votes
2 answers
3k views

mount is adding a quarantine flag, causing: /bin/bash: bad interpreter: Operation not permitted - but not the usual suspects

OK, I'm having a similar problem to: -bash: Applications/mvim: /bin/sh: bad interpreter: Operation not permitted - but it's not the same problem. I'm getting the same result. I've already verified ...
Kylar's user avatar
  • 211