This method provides an option which doesn't require sudo privileges.
This will install all Macports related stuff inside of a ~/macports
directory.
mkdir ~/macports
cd ~/macports
curl -fsSLO https://distfiles.macports.org/MacPorts/MacPorts-2.9.1.tar.bz2
tar -zxf MacPorts-2.9.1.tar.bz2
cd MacPorts-2.9.1/
./configure --enable-readline --prefix="${HOME}/macports" --with-no-root-privileges
make
make install
echo 'export MACPORTS_HOME="${HOME}/macports"' >> ~/.bashrc
echo 'export PATH="${MACPORTS_HOME}/bin:${MACPORTS_HOME}/sbin"' >> ~/.bashrc
echo 'set -gx MACPORTS_HOME $HOME/macports' >> ~/.config/fish/config.fish
echo 'set -gx PATH $MACPORTS_HOME/bin $MACPORTS_HOME/sbin' >> ~/.config/fish/config.fish