Deinstall an already removed port on FreeBSD
Sometimes we use alternate ports (in my case, openssl111, to get TLS 1.3 under nginx), and the port get replaced by another version (openssl111 got deleted and openssl was upgraded to 1.1.1)
pkg will process dependencies and uninstall all software built against openssl111. And we cannot “make deinstall” openssl111 as the port has been removed.
So assuming we are replacing a port with another one with the same version, we can create a temporary port. I use jails so I have to do this in basejail:
cd /path/to/basejail/usr/ports cp -vrp openssl openssl111 sed -i bak s/openssl/openssl111/ openssl111/Makefile cd openssl111 make deinstall
Voila! You just have to install openssl now.