MacPorts installation processes

Mojca Miklavec mojca at macports.org
Fri Nov 10 09:37:25 UTC 2017


Dear Patrick,

On 10 November 2017 at 09:56, Patrick Hinkle wrote:
> Sorry to ask these fundamental install questions but do I have to:
> 1.) Install MacPorts every Terminal session I run?

No, you must be misunderstanding something. You only ever need to
install MacPorts one single time. I usually do it from the binary
installer unless I want to test some new feature from macports base
development.

What's probably confusing you is that you have MacPorts installed, but
you don't see the "port" command because the PATH is not set up
properly.

MacPorts does some trickery to get this work automatically, but in my
case I have a file
    ~/.bash_profile
with a line reading something like
    export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
in it.

Then, whenever I start a new Terminal, /opt/local/bin is always in PATH.

When you start a new terminal, please check
    echo $PATH
to see whether /opt/local/bin is included.

> 2.) After I have installed MacPorts (where the Terminal will accept
> "port "-option"-type commands), do I have to re-install it every time I
> terminate my Terminal session? or my operating system session (running Mac
> OS X Sierra, 10.12.6)?

No.

> 3.) Do I have to uninstall MacPorts at some particular time/phase when using
> MacPorts?

Usually only when you do OS upgrade (say, when you upgrade from Sierra
to High Sierra).

Other than than: no, unless you screwed up something so badly that
reinstalling is the easier option.

Or if you want to downgrade to a lower version (usually you don't need
to do that, but if you installed from git/master and something breaks,
and then you want to go back to an older released version, rolling the
version back is not really supported and you might end up with
somewhat corrupt database if you try that, depending on how much git
master diverged from the released version.)

But in your case, I would probably remove /opt/local just in case
given all the other troubles you might have experienced due to several
repeated attempts of installing potentially incompatible versions.

> 4.) After performing "Source install" using section 2.2.2's installation
> techniques I use 2.2.5's "MacPorts and the shell" and have entered:
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> followed by 'port search', & 'port edit and I get the following bash output:
>
> Version number in metadata table is newer than expected.
>
>     while executing
>
> "registry::open $db_path"
>
>     (procedure "mportinit" line 642)
>
>     invoked from within
>
> "mportinit ui_options global_options global_variations"
>
> Error: /opt/local/bin/port: Failed to initialize MacPorts, Version number in
> metadata table is newer than expected.

This is not normal. It could happen if you somehow managed to install
several different versions of MacPorts on top of each other.

> Here, I am performing the "Source install" using section 2.2.2's
> installation techniques & section 2.2.5's "MacPorts and the shell"
> techniques - Is this Error just a product of me installing MacPorts more
> than once or does it justify me using other techniques, like uninstalling?

In this case I would run "rm -rf /opt/local" just in case. And then
install just once, ideally from binary installer (unless you have a
good reason to start from source, but most likely you don't need that
now). Before reinstalling please check your environmental variables,
PATH in particular, and how these paths are initialized. It might
depend on the shell being used (if you switch to something else than
bash, instructions are probably different).

Mojca


More information about the macports-users mailing list