Changing location of ports tree

Alex Zbyslaw xfb52 at
Sun Nov 6 21:16:05 GMT 2005

ross wrote:

> My /usr partition is to small for some of the larger programs  
> (, jdk, etc) and I want to move my ports tree to a 
> harddrive  with more space. can I just change the line in
> /usr/local/etc/pkgtools.conf that says "ENV['PORTSDIR'] ||= 
> '/usr/ports'"  to "ENV['PORTSDIR'] ||= '/mybigfatharddrive/ports'"?
> Will all the pkg tools such as portsnap, portupgrade, and portversion  
> continue to function properly? will I have to edit any other config 
> files  before this will work seemlessly?

Move the tree then make a symlink from /usr/ports to your new dir.  
That's guaranteed to work.  You could also try just moving the distfiles 
subdir and symlinking it, since that really takes the space (apart from 
building).  Without knowing how little space you have, it's hard to know 
if that will be good enough.

Just changing the ENV in pkgtools.conf will only work for tools which 
use it, which I don't think includes portsnap.  You'd want to set it in 
your root shell for everything to see it.

Or, for the larger ports just make with WRKDIRPREFIX set to somewhere 
with lots of space.  You can set that is pkgtools.conf per port, 
assuming you use portupgrade or in make.conf, for every port to use it.  
I don't like that as for some ports I sometimes need to keep the work 
subdir hanging around.

See man ports!


More information about the freebsd-questions mailing list