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?
Best Answer
Disentangling messed up dot files and environment variables and paths might be a lot of work if you didn’t follow the recommended steps precisely or made subsequent changes. What about making a list of the homebrew packages you have (if any) then removing it entirely. Same with macports - don’t try to adapt it to run in a new place - remove it entirely after you know what packages you need.
Then make a brand new user account - install homebrew there cleanly with a default path and having cleaned up /opt before you made the new account.
This will quickly let you know if you have a system problem or it’s just the weight of all the changes made to get the previous software to run.
The alternative to this will be a lot of back and forth and you dumping a ton of data into the question or arranging remote access with someone skilled in picking apart bash/scripting errors and digging into the code and what
brew doctor
has to say about your setup that’s broken.