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.