Macports force-activate all ports When trying to install SciTE

sudo port install scite


port stops at


  Error: org.macports.activate for port gettext returned: Image error: /opt/local/bin/autopoint already exists and does not belong to a registered port.  Unable to activate port gettext. Use 'port -f activate gettext' to force the activation.


but if I run sudo port -f activate gettext and re-try installing scite, I end up with the same error message, this time with /opt/local/lib/libffi.6.dylib and libffi and so on and so on...

How can I tell Macports to force activate all ports that stand in it's way from completing installing SciTE, without having to manually re-run the installation of the package I actually want and without having to copy-paste each activation command?
I was able to install the desired port by automating the activation process. The app fails to run due to some library version issues and I seem to be unable to fix those but that's a story for another answer or another question.


Create a script that continuously tries to install the port and automatically forcefully activates the discovered port that is blocking it. Copy paste the following into a file and call it port-instact.sh

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi
target="$1"
while [ 1 ]
do
    echo trying to install "$target"
    if [[ $(port installed "$target" | grep "$target") ]]; then echo "$target" present; break; fi
    line=`port install "$target" 2&gt;&amp;1 &gt; /dev/tty | grep "port -f activate"`
    package=$(echo $line | sed -e "s/^.*port -f activate //" -e "s/. .*//")
    if [ "$package" = "$oldpackage" ]; then echo double \""$package"\"; break; fi
    oldpackage="$package"
    echo activating "$package"
    port -f activate "$package"
done

Make the file executable via chmod +x port-instact.sh
Run it as root sudo ./port-instact.sh scite and wait