Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I really find that using bash helps a lot, when you need to retrieve strings of text that you used previously.

But how can I install it on FreeBSD?

I have tried typing bash into the terminal, but that returns: bash: not found

share|improve this question
If you're going to switch shells, you might as well switch to zsh. What features are in zsh and missing from bash, or vice versa? – Gilles Jul 19 '12 at 23:31
I recommend looking at the [FreeBSD handbook](www.freebsd.org/handbook/) for this kind of questions. Installing Applications: Packages and Ports – Gilles Jul 19 '12 at 23:33
up vote 6 down vote accepted

Assuming you have the ports tree installed, it's as easy as

cd /usr/ports/shells/bash
make all install clean

If you don't have the ports tree, just do this:

portsnap fetch extract

and then try again. You'll need to periodically update the ports tree:

portsnap fetch update


As pointed out by sr_ in a comment, FreeBSD also offers precompiled binary packages of many (most, but not all) ports. In practice, while they usually offer a faster install, I find the pkg_* tools don't handle installing dependencies as well as the ports system, so it can sometimes take a few goes to get everything working. However, it's well worth looking at pkg_add and friends.

There is a new poject under way, called pkgng, which aims to address the problems with the current pkg_* tools. It's still fairly new, but it looks good.

share|improve this answer
Thank you, I have just tried that now, and I do need the ports tree - which is currently "fetching". – Kevdog777 Jul 19 '12 at 12:59
There're also binary packages, i.e. pkg_add -r bash should suffice... (see this for more (maybe slightly dated) information) – sr_ Jul 19 '12 at 13:00
@sr_ - good point. My first recourse is always to ports, so I seldom even think about precompiled packages. – D_Bye Jul 19 '12 at 13:03
To make this bash binary your default shell run chsh -s /usr/local/bin/bash as the user you want to change the shell for. – Tim Jul 19 '12 at 13:34
This also works for zsh. – Sildoreth Apr 14 '15 at 20:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.