Loading sub-menu...

How to add path and environment vaiables on a Mac

Document Abstract
As a regular or former PC user, you may find yourself confused by how to add environment variables or add items to the PATH on a Mac - this page describes one way to do it.

This page describes one way that is sufficient when you will be executing commands from the command line in a terminal session.

  • Create a file called .profile in your home directory (that is /Users/<username>).
    • Tip: While in a Terminal session, you can always change to your home directory by typing "cd ~" or just "cd". Type "pwd" to print out and confirm the directory you are currently in.
  • Add environment and path variables in the .profile file as appropriate.
    • After modifying .profile, you'll need to start a new terminal session for the changes to pick up. To make sure everything works properly, you can throw a little echo greeting atop the file. When you start a new terminal, you should see the greeting echoed to you if the file has been recognized by the terminal session.
  • Here is a sample from my own .profile file:

Labels

mac mac Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.