pkg search elixir should work just fine. pkg search queries the repository database in /var/db/pkg/repo-FreeBSD.sqlite. You might want to check the permissions on that file. In my case they are -rw-r--r-- 1 root wheel pkg install and pkg delete do require elevated privileges, and hence the usage of sudo, doas or su. If you grow tired of having to type in your password you can always configure sudo to not ask for it for these commands specifically! To do so add something like:your_username ALL=(root) NOPASSWD: /usr/sbin/pkg install *, /usr/sbin/pkg delete *
visudo. Though you might want to read up on the dangers of using wildcards in sudoers() first