Macports error on OSX High Sierra

If you updated to high sierra and are reinstalling your ports, you may run into:

--->  Building osxfuse
Error: Failed to build osxfuse: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_fuse_osxfuse/osxfuse/main.log for details.

Look in that main.log

:debug:build Failed to locate 'lbzip2' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?

There’s an unlisted requirement of lbzip2. Install it.

$ sudo port install lbzip2

After installing lbzip2, try to install the package again, then check the main.log

:info:build /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/System/Library/BridgeSupport/ruby-2.3/bridgesupportparser.bundle, 9): Library not loaded: @rpath/libclang.dylib (LoadError)

Chances are it failed with the above error. Basically, the build script couldn’t find the libclang library. There is some in-depth discussion on the cause and workarounds at: To fix this, we’re going to add an aditional symlink to the library, as Xcode has a broken address for the library by default.

$ sudo ln -s /Applications/ /usr/local/lib/libclang.dylib

Once the symlink is created, install your failed ports again. In future you may need to remove the link as it may interfere with other builds once Apple’s Xcode is fixed.

Macports error on OSX Sierra

If you’re compiling a package and run into:

:error:configure Failed to configure gmp, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_gmp/gmp/work/gmp-6.1.1/config.log
:error:configure org.macports.configure for port gmp returned: configure failure: command execution failed

Then look at config.log, and find:

In file included from /Applications/
/usr/include/pthread.h:423:1: error: C++ requires a type specifier for all declarations
__SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead")
/usr/include/pthread.h:423:66: error: expected ';' after top level declarator
__SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead")
2 errors generated.

In this case __SWIFT_UNAVAILABLE_MSG hasn’t been been defined. The definition is meant to come from Availability.h at /usr/include/Availability.h

A few OSX/Macports releases ago there was Issue 48471. As a workaround, some people used a locally modified Availability.h installed in /usr/local/include/ or /opt/local/include/, which are preferentially included over /usr/include/.

As the underlying problem is now resolved they are no longer required and can be deleted.

$ sudo rm /usr/local/include/Availability.h /opt/local/include/Availability.h

Once they are gone the current version of Availability.h from /usr/include/ will be included next time you try to build your package.

If you wiped out your original /usr/include/Availability.h for any reason, restore it with:

$ sudo cp /Applications/ /usr/include/Availability.h

Permissions are fine as they are.


The macports-users mailing list also found this solution.

Alternatively, according to
you can comment out the problem line in pthread.h as a workaround. (note: I do not recommend this)