Well that looks like a corrupted MacPorts base.  If it were me, I would be
tempted to set aside the whole MacPorts tree, and do a clean reinstall of
base and ports from scratch.  If it is only a single file problem, you
could try reinstalling that single file from source.

"portlist.tcl" should look like this.  You would have /opt/local in place
of my custom prefix.  The file date should be Oct 29 if you are using the
latest MacPorts base version.  (I am still on 2.11.5, but this file is
identical between versions).

~/port/mp > ls -go libexec/macports/lib/portlist1.0/portlist.tcl
-r--r--r--  1   10041 Aug 18 05:47
libexec/macports/lib/portlist1.0/portlist.tcl

~/port/mp > md5 -r libexec/macports/lib/portlist1.0/portlist.tcl
6bbd985f7a2af02d5739b2de6ec6ec6e
libexec/macports/lib/portlist1.0/portlist.tcl

You might find a backup copy at /opt/local/src/portlist1.0/portlist.tcl.
Otherwise get from the MacPorts source distribution file.

You might also try just reinstalling the base on top of your existing
install.  I do not know how to do that correctly, since base and ports
share the same tree.  Consult the docs.

Look over base directories in /opt/local/libexec/macports and elsewhere,
for signs of other damage.  If more than just this single file, it is
probably best to just go for the complete reinstall.


On Wed, Dec 24, 2025 at 11:20 AM Jason Liu <[email protected]> wrote:
>
> Hi all,
>
> I was installing some ports last night just before going to bed, and this
morning after waking up, attempting to run any port command gives the
following error message:
>
> couldn't read file
"/opt/local/libexec/macports/lib/portlist1.0/portlist.tcl": illegal byte
sequence
>     while executing
> "source /opt/local/libexec/macports/lib/portlist1.0/portlist.tcl"
>     ("package ifneeded portlist 1.0" script)
>     invoked from within
> "package require portlist"
>     (file "/opt/local/bin/port" line 48)
>
> Is there any way to fix this?
>
> --
> Jason Liu

>

Reply via email to