Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a secure procedure to move the macports directory strucutre on a non-root partition or disk?

share|improve this question

Use a symbolic link...

A symlink is basically like a file or folder shortcut but it's different in that that it acts as though it is the location it's linking to. To the operating system, a symlink and the actual location are no different.

What you'd do is copy the contents of /opt/local to the new location (including hidden files) then, from the /opt/ folder create a symlink.

The format for symlinks is:

ln -s target link_name

So, the link would be something like:

ln -s /new/opt/local/location/ local

Since you want to put it on another disk/partition you have to make sure it mounts on boot. If mac doesn't automatically mount the drive/partition in question on boot you'll have to manually edit fstab.

Here's the wikipedia article on symlinks.

Here's a link describing how to move the '~/' or 'Home' folder in linux using a symlink. It should work relative the same in OSX since they are both POSIX

Here's a link describing how to edit fstab on Mac.

SideNote: I heart symlinks. They make some things sooooo much easier.


I forgot one thing. If you want to ensure 'secure' access to the /opt/local folder residing on an external disk. Permissions can be set for the whole disk in fstab. Or, per folder/file via chmod (if the OS supports permissions for that partition type).

share|improve this answer

You must log in to answer this question.