Installing MacPorts on MacOS “High Sierra”

Update 10.15: If you are looking for instructions on how to install MacPorts on Catalina, try here.

Update: The official MacPorts installer is out. Go get it!

Another year, another OS X update. I assume you are here because you downloaded the High Sierra GM from Apple, and were disappointed that there isn’t a MacPorts installer yet.  While I am sure they will release it soon, perhaps we can get you over the hump so you can beat up High Sierra before the official drop date.  If you are comfortable compiling software by hand, we should be able to get thru this easy-peasy.

I am doing this on a clean install of High Sierra. If you are attempting an upgrade from any previous version, your process may vary in unexpected ways.  You will want to make sure you’ve downloaded the latest version of Xcode, and you should probably follow the MacPorts uninstall instructions so you have less cruft around that could interfere with the process.  If you have an upgrade issue, please comment here and I’ll do my best to help you out and improve the instructions.

This is my first pass at getting it running.  I’m going to share all my steps.  One or two things I do might be unnecessary, and could be removed later if I refine the process; but I promise I wouldn’t have hit the Publish button if the overall process didn’t work.

  1. Install MacOS “High Sierra”
  2. Connect to the internet
  3. Install Xcode 9 from the App Store.
  4. Launch Xcode:
    1. Agree to the license.
    2. Let it install the extra components it says it needs.
    3. Quit xcode.
  5. Open a terminal window:
  6. sudo bash
  7. xcode-select --install
  8. When the pop-up launches, install the command line tools.
  9. cd ~/Desktop
  10. mkdir macports
  11. cd macports
  12. curl -O
  13. tar -xzvf MacPorts-2.4.1.tar.gz
  14. cd MacPorts-2.4.1
  15. ./configure --enable-readline
  16. make
  17. make install
  18. echo 'export PATH=/opt/local/bin:/opt/local/sbin:$PATH' >> ~/.profile
  19. source ~/.profile
  20. port -v selfupdate

At this point, you should be ready to start reinstalling your ports! Wee!

After manually installing MacPorts with the above instructions I was able to install subversion and wget, which are my usual two first validation tests.  Subversion alone has a total of 33 dependencies alone, and combined they have 135 dependent packages; which does a pretty good job of verifying MacPorts is working.

20 Replies to “Installing MacPorts on MacOS “High Sierra””

  1. Doesn’t seem to work for me with the GM.

    # port -d install wget
    DEBUG: Copying /Users/mark/Library/Preferences/ to /opt/local/var/macports/home/Library/Preferences
    DEBUG: Changing to port directory: /opt/local/var/macports/sources/
    DEBUG: OS darwin/17.0.0 (Mac OS X 10.13) arch i386
    DEBUG: Reading variant descriptions from /opt/local/var/macports/sources/
    DEBUG: Sourcing PortGroup muniversal 1.0 from /opt/local/var/macports/sources/
    DEBUG: universal variant already exists, so not adding the default one
    DEBUG: Executing variant ssl provides ssl
    DEBUG: Running callback portconfigure::add_automatic_compiler_dependencies
    DEBUG: Finished running callback portconfigure::add_automatic_compiler_dependencies
    DEBUG: Running callback portbuild::add_automatic_buildsystem_dependencies
    DEBUG: Finished running callback portbuild::add_automatic_buildsystem_dependencies
    DEBUG: dropping privileges: euid changed to 502, egid changed to 501.
    DEBUG: Starting logging for wget
    Segmentation fault: 11

    1. Was your High Sierra install a clean install, or an upgrade over a previous version of the OS?

      What’s your High Sierra build version?

      What version of Xcode are you running?

  2. Hi,

    I am running the High Sierra GM candidate and I could not get it working with Xcode 8 (last updated under Sierra).
    I had problems with GNUSTEP_SYSTEM_ROOT and finding the foundation framework, although I had the correct paths and files.

    I downloaded Xcode Version 9.0 (9A235) from the developer’s website and now it works.


  3. Hi Chris,

    Have you tried installing gcc6 or gcc7 on High Sierra? Both of them crash in the build process.

    (They are not listed as dependencies for subversion or wget, maybe that’s why it went smoothly for you.)

    1. I found two unlisted dependencies that break gcc6, but now I’m hanging on an include not finding stl_relops.h even though it exists in multiple locations. I’ll have to look at this more in depth later.

      The two missing dependencies are:

      1. I understand, just checking to see if it’s a common issue or a freak occurrence because I messed up the manual installation 🙂

        Turns out it is common actually, and you can work around it by disabling parallel building

        sudo port install gcc6

        Hope this helps 🙂

  4. Hi, I did an upgrade of High Sierra yesterday. I’m now getting a message: Error: Current platform “darwin 17” does not match expected platform “darwin 16” whenever I run the port command. I want to make sure that I keep my previously installed packages. Should I try your method for installing or will this force me to reinstall my packages? I’m not even able to view the ones I previously had installed due to this error message. Thanks for any help.

  5. Install goes fine (with sudo), but it fails on pretty much any port I want to install, e.g. sshpass

  6. First of all thanks! I’ve upgrade to a HS with a fress Install (to use APS) yesterday with the oficial release, and we still didn’t have an oficial Installer…
    I’ve an error during the make step.

    any ideas?? the

  7. Configure fails (10. ./configure –enable-readline). “GNUSTEP_SYSTEM_ROOT is not defined in your environment”. There’s no mention of installing GNUSTEP as prerequisite for installing MacPorts on MacOS “High Sierra”.

    So far Googling hasn’t turned up the right useful clues…

  8. Apparently, you need Xcode 9 and its command-line tools installed to get past the “GNUSTEP_SYSTEM_ROOT is not defined in your environment” problem/message, when installing MacPorts on MacOS “High Sierra”.

    Whatever release of Xcode 8 I had installed wasn’t enough. Moving forward… Thanks!

    1. I suspected as much, which was why I asked about your version of xcode. I did get it to install with 8.3.3, but that was with the GM and not the release version so I should probably re-test that. Step 5-2 should have installed the command line tools. Did that not happen for you?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.