I'm using HomeBrew for my usual mac stuff but I need to do some experiments with other package managers. So I installed MacPorts. everything seems alright but brew doctor asks me to move it:

warning: You have MacPorts or Fink installed: This can cause trouble. You don't have to uninstall them, but you may want to temporarily move them out of the way, e.g. sudo mv /opt/local ~/macports

So I listened and moved it. And then in my bash profile I changed

export PATH="/opt/local/bin:/opt/local/sbin:$PATH"

to

export PATH="~/macports/bin:~/macports/sbin:$PATH"

and now when I when run port ... it gives me this error:

-bash: /Users/foobar/macports/bin/port: /opt/local/libexec/macports/bin/tclsh8.5: bad interpreter: No such file or directory

What am I doing wrong and how can I solve it?

P.S.1.

I edited the /Users/foobar/macports/bin/port file as the admin and edited the first line from #!/opt/local/libexec/macports/bin/tclsh8.5

to

#!/Users/foobar/macports/libexec/macports/bin/tclsh8.5

now I get this new error:

sources_conf must be set in /opt/local/etc/macports/macports.conf or in your /Users/foobar/.macports/macports.conf file while executing "mportinit ui_options global_options global_variations" Error: /Users/foobar/macports/bin/port: Failed to initialize MacPorts, sources_conf must be set in /opt/local/etc/macports/macports.conf or in your /Users/foobar/.macports/macports.conf file

P.S.2.

changed all the /opt/local s to ~/macports s in

/Users/foobar/macports/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_ci/bootstrap.sh

and

/Users/foobar/macports/etc/macports/macports.conf

nothing changed!

P.S.3.

I see some of the guys here try to guid me towards removing/uninstalling MacPorts or HomeBrew. That's not what I'm asking for. I am able to revert all I did and make the MacPorts work again (in fact I just did that). My question is why HomeBrew Is saying that? what I happens If I don't do what it is asking for? What if I want the MacPorts too? and most importantly how make the MacPorts keep working after moving?