[GRASS-dev] [GRASS GIS] #3462: Allow setting environment variables in grass startup script

GRASS GIS trac at osgeo.org
Mon Dec 18 13:47:57 PST 2017

#3462: Allow setting environment variables in grass startup script
  Reporter:  mankoff      |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  major        |  Milestone:
 Component:  Default      |    Version:  7.2.2
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  MacOSX

Comment (by martinl):

 Replying to [comment:8 mankoff]:
 > I'm not clear how the comment in `grass.py` pointing to this ticket
 helps. Certain critical environment variables that are **required** for
 GRASS to work correctly cannot be set in either `~/.grass.bashrc` or
 `~/.grass7/bashrc`, as long as the line ignoring `export` statements
 remains. Why can't I `export` variables from these scripts?

 As I mentioned earlier, the environment variables should be loaded by
 `load_env()`. I tested your config file and it's working on my Linux
 machine. So probably something related to MAC? Try to put more debug
 message around `load_env()`.

 cat ~/.grass7/bashrc
 export BAR=42
 export DYLD_LIBRARY_PATH=/opt/local/share/grass-7.2.2/lib

 GRASS_DEBUG=ON ./bin.x86_64-pc-linux-gnu/grass75 -text
 DEBUG: Environmental variable set BAR=42
 DEBUG: Environmental variable set

 GRASS> env | grep BAR

 GRASS> env | grep DY

Ticket URL: <https://trac.osgeo.org/grass/ticket/3462#comment:9>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list