Environment variables from ~/.MacOSX/environment.plist not read?

Hello,
I repost this from "Mac OS X 10.5 Leopard > Account and Login" since it was advised to me overthere. Sorry if your already read this one before.
I have a problem defining environment variables that should be visible to all my user processes, not only Terminal. According to the Apple documentation, I need to create a file ~/.MacOSX/environment.plist and define my variables in there.
Below you can see the exact paths and file name, together with the contents of the plist file:
<pre>
/Users/ringods/.MacOSX
AtrisoBook:.MacOSX ringods$ ls -l
total 8
-rw-r--r--@ 1 ringods staff 313 Sep 29 15:35 environment.plist
AtrisoBook:.MacOSX ringods$ cat environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANT_HOME</key>
<string>/opt/local/share/java/apache-ant</string>
</dict>
</plist>
</pre>
I then tried a logout/login sequence, but no ANT_HOME environment variable was defined. Even after completely rebooting, the environment variable was still not defined. I checked in a Terminal window using any of the following 3 commands:
<pre>
env
export
set
</pre>
This is on a MacBook Pro running 10.5.5. Am I missing something here? Does anyone know how to resolve this?
Ringo

I'm currently experiencing the same issue.
I find however, if I take out the underscore from the name it works. At least the times I've tried.
There is a post about using launchd.conf for configuring environment variables, but I couldn't get that to work either.

Similar Messages

  • [SOLVED] Pass Environment variables from PKGBUILD to .INSTALL script

    Hi everyone,
                       I am trying to modify the grub2-efi-bzr (http://aur.archlinux.org/packages.php?ID=38369) package making some changes in the PKGBUILD and the post-install script. I want to pass few environment variables from the PKGBUILD to the install script. How do I do that?
    Some code from the PKGBUILD
    _bzrtrunk="lp:grub/grub2" # GRUB2 BZR Main Trunk
    # _bzrtrunk="lp:~skodabenz/grub/grub2-bzr-exp" # GRUB2 BZR Experimental Branch
    _bzrmod="grub2"
    if [ ${_bzrtrunk} = "lp:~skodabenz/grub/grub2-bzr-exp" ]
    then
    _bzrmod="grub2_exp"
    pkgver="exp_${pkgver}"
    fi
    # grub-extras bzr repo locations
    _bzrtrunk_zfs="lp:~skodabenz/grub/grub2-extras-zfs"
    _bzrtrunk_lua="lp:~skodabenz/grub/grub2-extras-lua"
    if [ "$CARCH" = 'i686' ]
    then
    _EFI_ARCH=i386
    elif [ "$CARCH" = 'x86_64' ]
    then
    _EFI_ARCH=x86_64
    fi
    # _EFI_ARCH=x86_64 # Uncomment if you want to override the if condition for _EFI_ARCH above, incase the EFI ARCH does not match the Linux Kernel ARCH.
    # $CARCH=x86_64 and _EFI_ARCH=i386 requires gcc-multilib with lib32-glibc installed in the system.
    # I do not know about $CARCH=i686 and _EFI_ARCH=x86_64
    if [ ${_EFI_ARCH} = "i386" ]
    then
    pkgver="${pkgver}_x86"
    _trns_name="grub2_efi_x86"
    elif [ ${_EFI_ARCH} = "x86_64" ]
    then
    pkgver="${pkgver}_x64"
    _trns_name="grub2_efi_x64"
    fi
    Now the post-install script needs the values of _EFI_ARCH and _trns_name env variables. I do not want to copy the if statements to that script as these are decided at compile time but needed while setting up grub2-efi. This is due to the fact that EFI-ARCH need not match the Linux Kernel ARCH. How do I do that.
    Code from the post-install script
    ${_trns_name}-install --root-directory=/ --no-floppy --recheck --debug
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/lua.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfs.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfsinfo.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/unifont.pf2 /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/ascii.pf2 /boot/${_trns_name}/
    ${_trns_name}-mkimage --verbose --directory=/usr/lib/${_trns_name}/${_EFI_ARCH}-efi --prefix="" --output=/boot/${_trns_name}/grub2.efi --format=${_EFI_ARCH}-efi ${_EFI_APP_MODULES}
    Thank in advance.
    Last edited by skodabenz (2010-07-27 15:46:40)

    falconindy wrote:
    Don't rely on %foo% existing -- it won't after the first build and this will prevent the PKGBUILD from being reentrant. I would use something like this (untested):
    sed -i "s|^\(_EFI_ARCH\)=.*|\1=${_EFI_ARCH}|; \
    s|^\(_trns_name\)=.*|\1=${_trns_name}|; \
    s|^\(export _EFI_APP_MODULES\)=.*|\1=${_EFI_APP_MODULES}|" \
    ${startdir}/grub2-efi-bzr.install
    Your code works except for 1 problem in the install script I want
    export __EFI_APP_MODULES="${_EFI_APP_MODULES}" (the passed ${_EFI_APP_MODULES} value should again come inside double quotes).
    right now
    export _EFI_APP_MODULES=ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm
    which is equivalent to
    export _EFI_APP_MODULES=ata
    I want
    export _EFI_APP_MODULES="ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm"
    How to do it with sed since sed already uses double quotes?

  • How to access environment variables from Oracle Forms

    Hi,
    Any idea how to use the Environment variables from Oracle Forms.
    My basic problem is that from Oracle form I am calling Batch file which calls excel file with a macro.
    So i want to check whether the macro was successful or not.
    So in my batch file i will set %errorlevel% which I should be able to read from Oracle Forms.
    I am able to read the registry from oracle forms, so is there anyway to read environment variable as well?
    Thanks!
    Avinash.

    Hello,
    Use the TOOL_ENV.Getvar() built-in
    Francois

  • Setting windows environment variables from Java program

    Is there any way to set environment variables from Java program in Windows? Any help is appreciated.
    Here is my situation:
    I need to decrypt an encrypted Oracle user password in a batch file which will be used while running a sql script with sqlplus. I was planning to have bat file which will call a Java program decrypt the password and set it as an env variable in windows which will be available while calling sqlplus.
    thanks

    Runtime.exec has a lot of overloadings. Two of them
    allows you to specify the environment variables.
    exec
    public Process exec(String[] cmdarray,
    String[] envp,
    File dir)
    throws IOExceptionExecutes the specified command and
    arguments in a separate process with the specified
    environment and working directory.
    cmdarray - array containing the command to call and
    its arguments.
    envp - array of strings, each element of which has
    environment variable settings in format name=value.
    dir - the working directory of the subprocess, or null
    if the subprocess should inherit the working directory
    of the current process.
    I had this sample program:
    public class SetVarExample {
    public static void main (String[] args) throws Exception {
         String[] cmd_env= new String[] {"password="+"ABCD","Path=C:\\Sun\\AppServer\\jdk\\bin"};
         String cmd = "cmd /c SET ";
         Runtime.getRuntime().exec(cmd,cmd_env);
    System.out.println( "Finish ...." );
    I tried it in a command prompt. But looks like when the program exits, it's a whole new process and so it does not retain the env variables set in the java program.
    Any suggestions? Am I doing it worng?
    thanks

  • How to get an environment variable from OS in class ?

    Hello,
    How to get an environment variable from OS in class ?
    Thanks !

    An example of a Java application that does this is Ant, when you add a line like this in your build.xml:
    <!-- Import environment variables -->
    <property environment="env"/>
    I have looked at the source code of Ant 1.3, especially the file src/main/org/apache/tools/ant/taskdefs/Execute.java. Look at the methods getProcEnvironment() and getProcEnvCommand(). Ant uses an OS-dependent trick to get the environment variables.
    You can download the Ant source code from http://jakarta.apache.org/ant
    Jesper

  • How to access environment variables from pluggable destination?

    Hi,
    I'm trying to create a java puggable destination for reports. Everything is working fine.
    I want to access reports environment variables from the java code (like REPORTS_PATH and other new variables that I want to create), but I can't find anything about this in the java API documentation.
    I want to use environment variables instead of destination properties (those I can easily access), because I want to be able to change context using env_id.
    Any ideas?
    Thanks,
    Luis

    I'm using Oracle Application Server Version 10.1.2.0.2
    Thanks

  • Within JBuilder, Reading Environment Variable From a BATCH File

    Hi ppl:
    Following my scenario without JBuilder. I would like to be able to do the same with JBuilder, so that I can run my application from within.
    1. In the DOS window, I run a config.bat file that sets up a whole bunch of environment variables and then calls another script file that sets up another whole bunch to set up environment for a third party API (C++ based).
    2. My application uses native methods to call the third party API which uses the environment variables set in step 1.
    I know how to set the environment varialbes in JBuilder (Project Parameters, VM). However, I don't know how I can call a batch file that does the same. I don't want to set up the third party variables in JBuilder manually, since the script that sets them up checks on a few things to customize the environment.
    I also know how to run a batch file from JBuilder, but that does not set the environment for the application. It seems like the batch file is run in a separate process.
    Any ideas?
    Kamran

    It seems like the batch file is run in a separate process.Yes, it is. That's a design feature of Windows. The environment variables that a process creates are available to any subprocess, but when the process ends, the environment variables vanish. That's because they are part of the process, not global variables as you might wish.
    So that's why your non-JBuilder scenario works; your C++ program is running in a subprocess of the process that defined the environment variables. And your JBuilder scenario doesn't work because the batch file it runs is in a process whose parent process is Windows, not JBuilder.

  • Can not create a environment variable from a script

    Hi I need to develop a script that allows me to create and set two environment variables in my system but I can�t get it ....
    This is what I got till now ...
    #!/sbin/sh
    SEISDB_HOME=/usr/local/
    export SEISDB_HOME
    LD_LIBRARY_PATH=/usr/local/lib
    export LD_LIBRARY_PATH
    If I run this commands directly in the shell it works Ok ... but calling the sentence from a script nothing happens ....
    Thanks ....
    Edited by: Jes_79 on Sep 18, 2007 1:58 PM

    do this
    create a script file
    vi /tmp/temp
    in /tmp/temp add
    GLOBAL_VARIABLE="Hello World"; export GLOBAL_VARIABLE
    save and quit vi
    fix the permissions and run /tmp/temp from a shell prompt
    then
    echo $GLOBAL_VARIABLE
    should show as empty
    from a shell window type
    . /tmp/temp
    period space /tmp/temp
    echo $GLOBAL_VARIABLE
    for you script, do the same.
    do not type the script name, but source it (add a period and space)
    alan

  • Jar file doesn't read classpath environment variable from windows xp

    I created a small program that uses javamail and jdbc driver. I program on Win XP and use java 1.6.04.
    When I compiled my classes the program works fine but when I created a jar package the jar file cannot 'see' the classpath that windows has already set.
    I have to set the classpath in the manifest file and then it works ok.
    Is this normal? I was expecting that the jar file would work just fine without any complication since the classpath is already set in the system?
    If you could point to any documentation that covers this it would be great.
    Thank you very much.
    Genti

    genti_tech wrote:
    I specified the class-path in manifest in jar file and I looked at the tutorial you are suggesting:
    http://java.sun.com/docs/books/tutorial/deployment/jar/
    which is not clear at all about the fact that jar ignores the class-path environment variable.It is specified for java. http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#-jar

  • RCP, Environment Variables, OS X, Info.plist and LSEnvironment

    I've got a somewhat challenging problem here.
    I've got an RCP application that relies upon some shared dynamic libraries which might not be in standard locations (as this is OS X and they are user installed).
    One of the things we need to configure is DYLD_LIBRARY_PATH in order for the shared libraries be discovered. The problem here is OS X doesn't have a simple way to set environment variables that applications launched from the Finder can "see".
    One of the thing that I've found, but not had any success with, is to dynamically modify the RCP's Info.plist to have an additional key LSEnvironment whose value is a dictionary to set environment variables only visible to that application - okay this seems ideal for me. But it's not working.
    I also found that I could use launchctl setenv to set a user global Environment variable, however it's not persistent across launches, and each time I set, I must restart the app. I really need this persistent.
    Does anyone have any solution for setting Environment variables that are visible from the RCP app (and it's children) that works in OS X without having to launch the RCP app from a terminal?
    Thanks in advance!

    Brian de Alwis wrote on Wed, 05 August 2015 19:54Sounds like you want to use System.loadLibrary() with absolute paths?
    That doesn't quite work, as we aren't using JNI. Unfortunately the use-case details get pretty complicated - so I omitted in an effort to make it simpler to understand the problem.
    Basically we have built an IDE that uses the Prolog interpreter, XSB. XSB natively connects to MySQL using the shared MySQL libs. Unfortunately on OS X, MySQL can get installed into possibly one of many locations, and it certainly doesn't install it's libs in /usr/local/lib or /usr/lib. We access XSB via a Java library called Interprolog, which I believe, is just a pipe interface to the command line shell - hence when the Interprolog engine object is instantiated, it fires up a shell process for XSB - which needs to locate those MySQL libraries. Hence, DYLD_LIBRARY_PATH needs to be set to have the path for /usr/local/mysql/lib (or wherever the user installed it) defined in the parent process in order for Interprolog's sub-process to pick up the environment variable.
    Right now there are only 2 reliables ways I have found to get this to work.
    1. Launch Terminal, export the environment variable. Then launch our RCP app from the Terminal. - cumbersome and unintuitive; bad user experience.
    2. Launch Terminal, use `launchctl setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib`. And then one can lacuna our RCP app using Finder. - problem is that DYLD_LIBRARY_PATH is now global to the environment and will not persist between reboots.
    I've tried added the LSEnvironment dictionary to the Info.plist within the RCP application, but that just doesn't seem to work - and I'm not sure if that is because the OS X eclipse launcher doesn't propagate the environment forward or what. For the time being I have a way for the user to click a button which runs launchctl setenv and then prompts the user to exit the app, and then launch again from finder [IWorkbench.restart() doesn't work because new process is a child of the current] - which works but is undesirable workflow as it doesn't persist across a login/reboot.
    My next step is to try what is outlined here: http://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set
    However it feels even more sketchy than just modifying the Info.plist to contain the right environment variables.

  • How to export an environment variable from command line ?

    Hello,
    I have build a python application which run some processes(or executable or other python scripts) using subprocess.
    i.e.
    subprocess.call(["xyz.py"], shell=True, stdout=log_file, stderr=log_file)
    Above call throws an error as "xyz.py is not recognized as an internal or external command." I added the location of xyz.py into path variable inside a batch script which I used to run before running the script.
     set PATH=D:\path of xyz:%PATH%
    But As subprocess executes a script into anther child shell, This setting is not available in child shell (or sub-shell) used by python script.
    How can I make this PATH setting available to sub-shell also ?

    Rather than going into much details I have used explicit path by referring only one environment variable of the shell where application is running.
    i.e.  As xyz.py will be in a specific location of my repository, I am setting path of root_dir:
          set root_dir=<path_of_root_dir>
          And then,
          subprocess.call([os.path.join(os.environ['roo_dir'], 'dir', 'xyz.py')], ...)

  • Extract Environment Variable from System Variables

    Hi,
    I want to define a custom environment variable manually and from my code I want to retrieve the value for that system variable which I have created.
    Steps:
    Manual Actions
    1. Right Click "My Computer" >> Properties >> Advanced System Settings >> Advanced >> Environment Variables
    Here I have 2 options. User Variables and System Variables.
    In either of these I have to declare a variable - "Test Region" and its value as "Test1"
    Now, when I run my c# program I have to get "Test1" as output when I provide "Test Region" as parameter.
    Please provide me the code for this.

    Dear Cheong,
    It is working perfect now, when I restarted the PC.
    But the problem is each time when I change the Value of the environment variable, I need to restart the PC to make it effective.
    Is there any solution for this?
    Your support is much appreciated.

  • How to invoke environment variables from a remote server

    Hi Guys;
    I am new to java programming and have very basic knowledge. I am trying to get some environment variable information from a remote server. I have created a program that gives me the env variables from my machine but I need to connect to some other server and bring those variables.
    Can someone help me with this?
    Regards,
    Aditya

    there is no way to get that information from a remote machine without that machine having some program installed on it that you can poll to ask for it (and no machine should have a program like that on it, it's a potentially massive security hole).

  • Accesing environment variables from Runtime.exec()

    Hi All,
    I have a problem for which I need help. I have a property BLAH set to "abc" in my ~/.bashrc. My programme looks as following.
    Runtime rt = Runtime.getRuntime();
    String command="java -Dext.prop=${BLAH} Test1";
    //Even following also dont work I removed curly braces
    // String command="java -Dext.prop=$BLAH Test1";
    try {
    rt.exec(command);
    } catch (IOException e) {
    e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    I just want to set the value of environment variable to a property "ext.prop" and in class Test1 I would like to access it as System.getProperty("ext.prop"). The problem is that the value of System.getProperty("ext.prop") is $BLAH instead of "abc" which I set in my ~/.bashrc.
    If I execute the same command ("java -Dext.prop=${BLAH} Test1") from command prompt then I don't have any problem. I tried in another way also that is
    Edited by: ragsger on Dec 22, 2008 12:59 PM
    Edited by: ragsger on Dec 22, 2008 1:00 PM

    Replacing $BLAH with the value of the environment variable BLAH is handled by the shell and since you don't call a shell, you'll have to do that on your own.
    System.getenv("BLAH") will get the value.

  • How do you get LOCAL_ADDR environment variable from weblogic?

    How can you access environment variables, such as LOCAL_ADDR? The request object does not expose methods to get at all the environment variables? I need to know which NIC Card the request is coming off of, which the LOCAL_ADDR will tell me.

    Some variables you can?t get this way.
    I made shellscript that just looked like this.
    set > /yourdir/yourfile.txt
    Then in my class I did Runtime.exec(shellxcript);
    then you just read in "/yourdir/yourfile.txt" as Resource and load it in
    a Property object.
    After that you can get variables to.

Maybe you are looking for