I just tried to run a ruby script on a FreeBSD box I hadn't used in a while, and got "ruby: Command not found." So I figured I just hadn't previously installed it. Went to /usr/ports/lang/ruby22 and did a make install clean. That told me that ruby22 is already installed.

So then I did a pkg version -v, which showed me that it was in fact installed. I then thought maybe it had a bin directory that had for some reason been removed from $PATH, or something like that, so I did a make deinstall and then a make install. It claimed to have installed just fine, but still I get the "ruby: Command not found" error.

Investigating further, it did install a /usr/local/bin/ruby22 executable, and I guess I can just make a symbolic link to it, but... is something going wrong here? Is there perhaps some install step I haven't taken which would let FreeBSD know that I really, really do want to use this particular version of Ruby as the machine's default "ruby"?

In case it matters, this is 10.1 RELEASE amd64, and the ports tree is completely up to date, as are all installed packages.

1 Answer 1


According to /usr/ports/UPDATING:20150301, the default version of Ruby is currently 2.1. If you want to use 2.2 as the default instead, you should update the DEFAULT_VERSIONS knob in /etc/make.conf:


You will then need to reinstall Ruby 2.2 to ensure you get the binaries and scripts installed with the expected names (i.e. without the version suffix).

  • Note also that the ruby22-2.2.3 package at least doesn't actually install a ruby binary or symlink, it only installs /usr/local/bin/ruby22. Make your own symlink or edit your ruby scripts' #! lines and give three cheers and a hooray for high-quality systems integration in packages. yay freebsd.
    – cas
    Nov 5, 2015 at 1:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .