Skip to main content

Posts

Showing posts from October, 2018

Eclipse and Environment Variables in Mac OS X

After setting the environment variables for a user on a new Mac OS X machine (see post from 12 Oct 2018), I was surprised to see that Eclipse was unaffected by my changes to PATH. Some details: in my scenario, the development project uses Maven for its builds, but one step runs scripts in a bin folder. That folder has been added to my PATH. They run fine from the terminal, but from Eclipse the script steps always fail with an error something like "Cannot run xyz - No such file or directory". The reason turns out to be:  the PATH changes are made at the level of my user profile, but the Eclipse app does not refer to my individual user profile (when launched through the Finder or icon tray). A Google search turns up lots of suggested solutions. There are so many because the approach has changed over the years, and people have different thresholds of what solutions they are willing to use, how much mucking they are comfortable with or allowed to do by their organization.

PATH and Environment Variables in Mac OS X

I have been using Windows since the days of Windows 3.1, and I have become very comfortable mucking around in the guts of the Operating System. Then I was given a Mac OS X machine to configure for development recently. Setting it up with versions of Java, Ant, and other pieces necessary for development meant that I had to create some new environment variables (like ANT_HOME) and change others (like PATH). Which raised the question: how do I set environment variables for my account on a Mac? Here are the steps for OS X 10.13 High Sierra Open a Terminal window (Applications -> Utilities -> Terminal)  Check for a .profile file in your home directory $ ls -a  Use an editor like vim or emacs to open the .profile file if it exists, or create it if not. In vim, press "i" to enter "insert" mode and "Esc" to return to command mode. $ vim .profile  Add the new environment variables, using the "export" command, e.g. export ANT_HOME=/Users/Ste