Trying to open a python3 virtual environment I have created with

python3 -m venv myVenv

by doing

source myVenv/bin/activate

as I do in Linux, but I get

ksh: source: not found

which mean it is not in my path/installed. When I try to add it with pkg_add, it just tell me it can't find it. Does OpenBSD use something else that allows me to use venv or what should I do?

  • source is a bash command. To switch to bash as your login shell, if this would make your life easier, install the bash port/package and update your login shell with chsh. bash would be installed as /usr/local/bin/bash on OpenBSD. – Kusalananda Mar 4 at 17:42

You are using the Forsyth PD Korn shell, the usual login shell on OpenBSD. The PD Korn shell does not have a source command. The source built-in command is only available in some shells. The command that you want is the . command.

Further reading


The source keyword which is available in bash is not part of the Posix standard. Instead you can use

. myVenv/bin/activate

You could use the same syntax with . in bash which you are using on your Linux system.


As an alternative, you can simply launch a new bash shell, and source it there:

ksh$ bash
bash$ source myVenv/bin/activate
(myVenv) bash$ python ...

As a bonus, this gives you an easy way to deactivate the venv and return to a pristine environment: just exit from the bash shell and you'll return to ksh!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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