# Cross-OS environment variables (using the AIO packages)

**URL:** <https://gramps.discourse.group/t/cross-os-environment-variables-using-the-aio-packages/6940>\
**Category:** Help\
**Created:** [February 6, 2025, 7:18pm UTC](https://gramps.discourse.group/t/cross-os-environment-variables-using-the-aio-packages/6940 "2025-02-06T19:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![englomerican](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/englomerican/32/5938_2.png) [@englomerican](https://gramps.discourse.group/u/englomerican)\
**Post date:** [February 6, 2025, 7:18pm UTC](https://gramps.discourse.group/t/cross-os-environment-variables-using-the-aio-packages/6940/1 "2025-02-06T19:18:46Z")

</div>

Hi All,

I’ve been trying to make my Gramps media folder cross-platform (between Windows and MacOS), and I figured it out but I have some questions…

I’ve found a couple of previous discussions on this topic, but they didn’t really resolve the issue, or they weren’t about Windows and Mac - so instead of reviving those old threads ([here](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/10) and [here](https://gramps.discourse.group/t/help-with-relative-media-paths-and-multi-system-setup/4205) for reference), I thought I’d post a new one.

**my full media path for each system is:**  
windows: “d:\username\Dropbox\FamHistory\media”  
MacOS: “/Users/username/Dropbox/FamHistory/media”

you’ll note I’m storing media on Dropbox, and that I have it installed in my home folder on MacOS (typical) but on a separate drive in Windows (atypical).

**In my Gramps installation on both OSes, with my tree loaded, the “Family Tree Media Path” is:**  
`{GRAMPSMEDIA}/Dropbox/FamHistory/media`

**In my Windows 11 install:**

1. Win+R (“Run”), then type in “sysdm.cpl” to the box and hit OK
2. In the “Advanced” tab of the dialog that pops up, choose “Environment Variables…”
3. In the upper panel of the dialog that pops up (“User variables for ”) choose New…
4. Variable Name: GRAMPSMEDIA
5. Variable Value: D:\username

**In my MacOS (Monterey) install:**

1. go to /Applications/Gramps.app, right-click and choose “Show Package Contents”
2. in the Finder window that opens, find gramps\_launcher.py in Contents \> Resources. Open that using a **text or code editor**
3. near the end of the file, just before `if __name__ == " __main__":` add the line `environ["GRAMPSMEDIA"] = environ["HOME"]`
4. Save the file (make sure you do so as TEXT ONLY)

**So… Questions I have:**

Is there a way I can set a permanent environment variable in MacOS that the Gramps MacOS AIO package will pick up when it runs?

I tried adding GRAMPSMEDIA as an env variable in `.zshrc`, `.bash_profile`, `.bashrc` – I even created a `.profile` file. However, I couldn’t get the python in the MacOS All-in-one package to pick up environment variables. I guess I don’t really know how MacOS executes app packages. How does this work? Is there a wayo to get it to work where I don’t have to alter the application package each time I update Gramps?

---

<div class="post-metadata">

**Author:** ![csam](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/csam/32/5361_2.png) [@csam](https://gramps.discourse.group/u/csam)\
**Post date:** [February 7, 2025, 11:02am UTC](https://gramps.discourse.group/t/cross-os-environment-variables-using-the-aio-packages/6940/2 "2025-02-07T11:02:03Z")

</div>

On macOS you need to run the command ‘launchctl’ from a terminal window.  
`$ launchctl setenv GRAMPSMEDIA path_to_media`  
Not sure if you need ‘sudo’ in front of launchctl

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [March 9, 2025, 11:02am UTC](https://gramps.discourse.group/t/cross-os-environment-variables-using-the-aio-packages/6940/3 "2025-03-09T11:02:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
