0

I am trying to setup a environment variable in OS X Yosemite. i am using zsh. i added

  export NEW_HOME=/Users/k/app/

and then loaded the file with

  source .profile or source .bash_profile

but when i restart the terminal it goes away. Then i added this to .zshrc file. It works. I can get the environment variable from terminal now. But the java application which requires this ENV value is not getting.

I really do not understand whats going on. Can u help me?

sukanta
  • 541
  • 6
  • 18

1 Answers1

0

Its solved by creating a environment.plist file in Library/Launchctl and seting the setenv inside string.

~/Library/LaunchAgents/local.launchd.conf.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>Label</key>
             <string>local.launchd.conf</string>
               <key>ProgramArguments</key>
                 <array>
                   <string>setenv NEW_HOME /Users/k/app/</string>

                 </array>
               <key>RunAtLoad</key>
               <true/>
            </dict>
          </plist>

And after restating the Mac it started working.

sukanta
  • 541
  • 6
  • 18