How can I quickly install FreeBSD ports?

I am a Linux system administrator, so my knowledge of the specifics of FreeBSD are very literal, and not very thorough; I've been configuring packages and what not a for a few days now and every one of them has taken a very long time because I am being prompted for decisions (for various options I cannot select anyway).

Is there any way to bypass/automate this selection process so I can leave this unattended while the building, etc. occurs?


First, you can select any option the system presents you with.
Port maintainers take a great deal of time to make sure that the options presented work (or mark them as broken/experimental). If you're compiling stuff from ports we generally assume you want these options so you can customize the installation to suit your environment.


To answer your question, you have a few options:

Option 1: Use packages instead of ports.
If you're new to FreeBSD and have no need to customize options this is probably the choice for you. It saves you both the configuration step and the compile time.
Refer to the FreeBSD Handbook for more information on using packages.

Option 2: Use -DBATCH when building ports
make -DBATCH will tell the ports system that you are "batch-builing" ports and won't be hanging around to answer config questions. It will use the default options for any ports that need configuring.
You can also add BATCH=1 to /etc/make.conf to set this permanently.

Option 3: Use make config recursive before you build
This allows you to configure all the ports that need configuring before your build starts.
Note there are a few ports where this doesn't work, so you might still get a few prompts, but it takes care of the majority of them.
For the sake of your sanity, run this only on the ports you intend to build. You could be there for a very long time if you run this at the top level of the tree and try to configure every possible port.


If you configure ports to suit your environment you should copy the contents of /var/db/ports someplace safe when you're done. The /var/db/ports/*/options files contain the configuration settings you selected, and can be used in the future to avoid having to use the configuration menu system again.