See also: Ports
Installing software in FreeBSD is very easy if you use the ports tree. To use the ports tree you will first need to install it. If you have the ports tree installed on your system you should try and keep it updated with the most recent software.
Remember you can always get help with ports by typing:
> man ports
To install a specific program you can search the ports tree to see if there is a port.
> cd /usr/ports/ > make search name=bash (listing of all the ports that have 'bash' in their name) > make search key=bash (listing of all the ports that have 'bash' anywhere in the description)
The top command will return a number of results that look something like:
Port: bash-2.05b.007_2 Path: /usr/ports/shells/bash2 Info: The GNU Bourne Again Shell Maint: obrien@FreeBSD.org B-deps: R-deps:
This listing tells you where the port you want to install is, in this case it is in shells/bash2. Now there are a number of things you can do to install a port such as
> cd /usr/ports/shells/bash2 > make install (this will download, compile, and install the port and all of its dependencies) > make clean (this will clean up the port directory as well as dependencies after an install) > make distclean (same as clean but will remove the distfiles for the ports aswell) > make config (this will allow you to configure options for the port via a dialog) > make fetch (this will just download the source tarball to "/usr/ports/distfiles") > make extract (this will just extract the port to a ./work directory) > make patch (this will just patch the source files) > make depends (this will install (or compile) all of the dependencies of the current port) > make install distclean (commands can be written in sequence like this one to install a port then distclean)
Ports can also be deinstalled easily. You can do this:
> cd /usr/ports/shells/bash2 > make deinstall
But be careful, since deinstalling from the ports tree can break things if the port you are issuing make deinstall for is a dependency of any other ports. It is safer to use pkg_deinstall instead.