Mac OS X Lion no longer recognizes environment.plist?

前端 未结 10 1217
挽巷
挽巷 2020-12-09 02:38

Just installed Lion today and my PATH env variable is no longer being set by ~/.MacOSX/environment.plist. Did something change? Can\'t seem to find any info on that or how t

相关标签:
10条回答
  • 2020-12-09 03:22

    [[I'm copying this answer of mine into here, because it just may be helpful to someone:]]

    Due to my own explorations, I now know how to set environment variables in 7 of 8 different ways. I was trying to get an envar through to an application I'm developing under Xcode. I set "tracer" envars using these different methods to tell me which ones get it into the scope of my application. From the below, you can see that editing the "scheme" in Xcode to add arguments works, as does "putenv". What didn't set it in that scope: ~/.MACOS/environment.plist, app-specific plist, .profile, and adding a build phase to run a custom script (I found another way in Xcode [at least] to set one but forgot what I called the tracer and can't find it now; maybe it's on another machine....)

    GPU_DUMP_DEVICE_KERNEL is 3

    GPU_DUMP_TRK_ENVPLIST is (null)

    GPU_DUMP_TRK_APPPLIST is (null)

    GPU_DUMP_TRK_DOTPROFILE is (null)

    GPU_DUMP_TRK_RUNSCRIPT is (null)

    GPU_DUMP_TRK_SCHARGS is 1

    GPU_DUMP_TRK_PUTENV is 1

    ... on the other hand, if I go into Terminal and say "set", it seems the only one it gets is the one from .profile (I would have thought it would pick up environment.plist also, and I'm sure that once I did see a second tracer envar in Terminal, so something's probably gone wonky since then; long day....)

    0 讨论(0)
  • 2020-12-09 03:29

    Weird, cause here it works flawlessly. I had to setup a JRI environment to access R internals from a Java applications, and updating the .profile was not enough to have NetBeans catching all env vars.

    Creating the environment.plist file did the the trick.

    For reference this the file's content:

    Malessere:~ xxxxx$ cat .MacOSX/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>DYLD_LIBRARY_PATH</key>
          <string>/Users/xxxxx/lib/jri-2.13</string>
          <key>R_HOME</key>
          <string>/Library/Frameworks/R.framework/Resources</string>
       </dict>
       </plist>
    
    0 讨论(0)
  • 2020-12-09 03:29

    By default, Mac OS X (10.7.4 and up) does not support it any more. See http://support.apple.com/kb/TS4267

    0 讨论(0)
  • 2020-12-09 03:30

    Use ~/.launchd.conf instead (see man launchctl).

    See this answer for details.

    0 讨论(0)
提交回复
热议问题