MacPorts user environment settings

Tags mac

Summary

How to set user environment settings for MacPorts.

If the MacPorts install was performed as someone other than the end user, we’ll need to update their PATH environment variable.

Environment

This is a follow-up step if MacPorts did not return a path of /opt/local/bin/port to the query which port in Terminal.

Directions

  1. Log into the computer with a local admin account.
  2. Open Terminal.
  3. Acquire a super-user shell by typing the following command: sudo -s
  4. Navigate to the user’s home directory: cd /Users/uniqname
  5. Open the user’s .bash_profile for editing with your preferred editor, for example one of these:
    • nano .bash_profile
    • vim .bash_profile
  6. Add a path entry to the bottom of the .bash_profile file, by pasting in the following: export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
  7. Exit from the editor and save your changes.
  8. Exit from the admin shell.