Removing /usr/local

Every time I install a new application /usr/local seems to become larger. Would it be safe to remove whatever is inside that directory? I have a really small hard drive so I need to do whatever to maintain it lean. I will appreciate all advice.

Thank you.
 
All ports/packages install their files in /usr/local/. So, no, you can't simply remove it.
 
TroN-0074 said:
Every time I install a new application /usr/local seem to become larger.
Of course. The application has to go somewhere...

I'm guessing you're coming from a Linux environment. Whereas (most distributions of) Linux put(s) applications all over the place (e.g. /usr, /usr/local, /opt, /app, etc. etc.), FreeBSD observes a rather strict division between the base system and third-party applications. The latter are almost always placed in /usr/local. In other words: when you install an application on a FreeBSD system, /usr/local is where it goes.

Fonz
 
Every time I install a new application /usr/local seem to become larger

Isn't it logical that if you install a package, and /usr/local grows larger, that package has been installed to /usr/local?
 
Thank you for the replies. Sure make sense that the more apps I installed the fatter my file system will become. I just thought that when compiling a piece software the compiler was also shutting out some garbage files that I could remove. Like I said I have a rather small hard drive and I need to keep an eye on it before it becomes full.

Thank you.
 
I just thought that when compiling a piece software the compiler was also shutting out some garbage files that I could remove.

In ports system, progress files and final build "product" are kept in work subdirectory in port directory. It will not be deleted unless specified otherwise. The command is : # make clean. If you run it inside port directory, it'll clean that port. If you run it on whole ports tree (eg inside /usr/ports/), it will clean everything, but it's somewhat slow. If you don't have many ports installed (let's say up to 50), the following script could be useful :

Code:
#!/bin/sh

for i in `find /usr/ports -name work -type d`
do
    cd `echo "$i" | sed 's/\/[^\/]*$/\//'`
    make clean
done

The source files needed for port builds are kept inside /usr/ports/distfiles/. In case of cheap bandwidth vs expensive storage, you should periodically delete everything from that directory.

Ports tree itself has around ~ 870MB. Move it to somewhere and mount via NFS. Or compile ports on another platform-compatible computer into binary packages, copy and install. World source tree is also large (~ 700MB). In essence, perform your compilations elsewhere, so you don't need a whole build environment on-board.
 
Zare said:
If you don't have many ports installed (let's say up to 50), the following script could be useful :

Code:
#!/bin/sh

for i in `find /usr/ports -name work -type d`
do
    cd `echo "$i" | sed 's/\/[^\/]*$/\//'`
    make clean
done

# rm -rf /usr/ports/*/*/work
Is a lot faster and simpler.
 
Back
Top