Transitioning from Windows to the Mac. In Windows, I had a lot of environmental variables set-up that I used to speed up my work. Thinks like



That, and the "magic" of autocompletion in the "Run" box and in the file save/open dialogs, allowed me to move around very quickly.

I've set up the equivalent env. variables in the shell, and I can cd and mv etc to the proper directories, but I haven't found a way to do something similar for the GUI apps, so that I can use the same shortcuts in the applications...

I've followed the tips in https://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x to add the env vars to /etc/launchd.conf but when I am going to save a file (for example), I can't use $PROJ in the "directory selector" and have the file be saved there...

  • 1
    How would you use a GUI app to call an environment variable? Can you edit in a specific instance how this might work?
    – bmike
    Jul 10 '13 at 19:13
  • 1
    @bmike this is standard OS interaction call the function getenv() passing the name and it returns the value
    – mmmmmm
    Jul 10 '13 at 19:17
  • @Mark so this really isn't a user level question since you need to be developing an app to make the call? I'm assuming GUI means cocoa….
    – bmike
    Jul 10 '13 at 20:44
  • I'll try and take a few screenshots to show what I mean but at the moment I'm a all tied up, so it might take a bit. Basically, to "see" what I mean, define a couple of user env. variables in Windows and then type them in the location bar in Explorer, or in a "save" dialog box - you can do things such as %DOCDIR% <TAB> and it'll auto-complete and suggest alternates from there... Extremely powerful, mouseless way of navigating the system
    – JJarava
    Jul 11 '13 at 20:54

I don't believe variables set in the environment are going to work in the Open & Save dialog box (OSDB). It's a nice idea, but you'd have to admit, kinda neckbeardy.

The Macintosh way would be to use the Favorites list presented on the left of the OSDB. Drag your often used directories there and you have one-click access.

A much more powerful alternative is Default Folder X. This gives you an incredible degree of short-cutting and changes of default behaviors in the OSDB.

  • If you test it in Windows, you'll see that you can type in env. vars in any "explorer" dialog, and it'll auto-expand and auto-complete. It's kind of nerdy, but allows you to do all kinds of file management from the command line. Thanks for the tip about DefaultFolder X; other things I miss from OSX are being able to do "file actions" (like open a new folder, delete o rename files) from within the open/save/file dialogues.
    – JJarava
    Jul 11 '13 at 20:49

If you really want to use the mentioned environment variables in Save dialogs, you could set up expansion short cuts with a tool like TextExpander or Keyboard Maestro which can expand environment variables to typed text and then use the "Go to Folder" feature (short cut Apple-G) (which is available in Save dialogs) to type the locations from the expanded environment variables.

Note: Be aware that in the current Mac OSX Yosemite, the launchd.conf system not works anymore, but there are other ways to achieve the same thing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .