MacPorts on Mavericks

If you found this page looking for help compiling MacPorts for OS X 10.11 El Capitan, please check out this post.

FINAL UPDATE: 2013-10-26 – The Official MacPorts installer for Maverics has been released, so there is no longer a need to jump through hoops. Please visit the MacPorts Download page to get the official version.

If you are a bleeding edge lunatic who has installed Mavericks before the first patch release, you may have realized you can’t install any new MacPorts.  You can search ports, but nothing will install.  No worries, I can help.  🙂

Note:  These instructions have evolved a bit since they were first posted, prior to the official release.  If you visited before and had problems, try again now.  These instructions assume you have already installed Mavericks.

  1. Follow steps 1, 2 & 3 of the Migration page:
  2. Follow the Uninstall instructions:
  3. Install Xcode from the App Store
  4. Launch XCode, agree to the license terms, and enter your password in the auth dialog box.
  5. Go to Preferences/Downloads
  6. Select “Check for and install updates automatically” and then click “Check and Install Now”
  7. Open a Terminal window:
    ## Reset your path, in case you have a previous install that 
    ## might bugger the configure. (Thanks Rainer)
    export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    ## Install Xcode CLI. Install dialog should open up and auth 
    ## the install.  (Thanks Drew, and others)
    xcode-select --install 
    ## Fetch MacPorts source code
    curl -O
    ## Uncompress source and change to the source directory
    tar jxvf MacPorts-2.2.0.tar.bz2
    cd MacPorts-2.2.0
    ## Configure the make file for MacPorts (Thanks Clemens)
    ./configure --enable-readline  
    ## Compile MacPorts
    ## Install MacPorts
    sudo make install
    ## Fix your path (Thanks Peter)
    echo 'export PATH=/opt/local/bin:/opt/local/sbin:$PATH' >> ~/.profile
    source ~/.profile
    ## Update your ports
    sudo port -dv selfupdate
  8. Re-install your ports.
  9. Post nice comments.  🙂

UPDATE: 2013-10-23 – I really appreciate the feedback I’ve been getting on this page.  If the steps above don’t work perfectly for you, please check the comments below. 

UPDATE 2: 2013-10-23 – My apologies to everyone for the site slowness and instability earlier.  This was a new VM and I hadn’t optimized my Apache config.  I was caught a little off-guard by the huge increase in traffic.  🙂

UPDATE 3: 2013-10-24 – Thanks to all of the wonderful contributors to this thread, there are new, improved and simplified instructions. The current instructions have been tested in a brand new Mavericks VM, but should also work with systems that have previous MacPorts installs. If you have any problems, please leave me feedback and I’ll try to help.

54 Replies to “MacPorts on Mavericks”

  1. The ” 3. Install Xcode 5.0.1 GM seed” should have an addition to open the so you get the command line tools installed which it seemed to do automatically for me as it asked for the password and then installed them. Without the command line tools your ./configure step fails “configure: error: C compiler cannot create executables”.

      1. Hi,

        I read that the automatic install of command line tools performed by XCode 5.0.1 on first launch is incomplete.

        Indeed, I had to run “xcode-select –install” after opening Xcode

  2. Thanks for saving the day, or actually night. Installed Mavericks and Xcode 5 and was ready to start getting some real work done and discovered that there was no gdb. No problem, just go to macports — only to find that macports didn’t work. I’m back on track thanks to your excellent instructions.

  3. The only other issue i saw was changinging the macports.conf files and change the tar_command setting from
    /usr/bin/gnutar –no-same-owner
    /usr/bin/tar -0

    Xcode 5 command line tools are installed with:
    % xcode-select install

    After that the migration steps will work normally

  4. Obligatory nice comment – thanks buddy, this worked great for me once I realized I had made an error in the command (had –with-tclinclude as –with-tcl – gave a pretty interesting error that I couldn’t solve, of course)

  5. With the officially released version: If you have the command line tools installed (ensure using xcode-select –install), you do not need to specify all the –tcl flags. Just ./configure –enable-readline should be enough.

    1. Clemens,

      It is your findings that the GM is different that the release? I’ve got a spare Mac that I’ll do a test run on tomorrow. If that proves to be true, I’ll add a few notes to this page.

      1. From what I know it is not. This has worked the same way in the GM, but having Xcode installed apparently no longer forces installation of the Command Line Tools when you use `/usr/bin/clang`, which was previously the case. The `./configure` script needs a file called `` that’s only in the Command Line Tools, which is why you should explicitly call `xcode-select –install`. After that, installation should work without any special configure flags.

    2. Finally got a clean install of Mavericks running in a VM. Need to doc that up now too…

      Clean Mavericks. Clean Xcode. Installed CLI tools. Tried just ‘./configure –enable-readline’ and that did not work.

      bash-3.2# ./configure –enable-readline
      configure: WARNING: you should use --build, --host, --target
      configure: WARNING: invalid host type: –enable-readline
      checking build system type... Invalid configuration `–enable-readline': machine `–enable' not recognized
      configure: error: /bin/sh ./config.sub –enable-readline failed

      What did work was:
      CC=/usr/bin/cc ./configure --prefix=/opt/local --with-install-user=root \
      --with-install-group=admin --with-directory-mode=0755 --enable-readline

      1. It seems you were not using a double dash before --enable-readline but just copied the line from the blog comments here, where double dashes get mangled to –.

        The flags --prefix=/opt/local --with-install-user=root \
        --with-install-group=admin --with-directory-mode=0755
        you provided are all at their default values and should really not be necessary.

        1. Tried it with and without double-dash. Both failed:

          bash-3.2# ./configure –enable-readline
          configure: WARNING: you should use --build, --host, --target
          configure: WARNING: invalid host type: –enable-readline
          checking build system type... Invalid configuration `–enable-readline': machine `–enable' not recognized
          configure: error: /bin/sh ./config.sub –enable-readline failed

          bash-3.2# ./configure –-enable-readline
          configure: WARNING: you should use --build, --host, --target
          configure: WARNING: invalid host type: –-enable-readline
          checking build system type... Invalid configuration `–-enable-readline': machine `–-enable' not recognized
          configure: error: /bin/sh ./config.sub –-enable-readline failed

          But worked when I did this:
          bash-3.2# CC=/usr/bin/cc ./configure --prefix=/opt/local --with-install-user=root \
          --with-install-group=admin --with-directory-mode=0755 --enable-readline

          If --prefix=/opt/local --with-install-user=root --with-install-group=admin --with-directory-mode=0755 are defaults, then that would indicate CC=/usr/bin/cc is the missing ingredient. Sadly, I’m cutting far too deeply into my beauty sleep, so I don’t have enough time to spin up a clean VM to give it a try.

          1. Copying the line that fails for you I can reproduce your problem. The dashes in this line, however, are no really dashes, but some unicode characters with the byte encoding 0xe280 0x932d. Just type --enable-readline manually and it will work.

          2. Good catch. Thanks!

            ps. On a completely clean VM, dsniff-devel installed perfectly. Probably about time I wipe and reload my laptop anyways… 🙂

          3. You still had dashes instead of hyphens there when it failed. Better type it completely yourself instead of using copy & paste from the blog comments if they are not set in teletype font. The blog software tries to be smart and applies typographical “corrections”.

  6. This was remarkably easy on the release version of 10.9 from the App Store. The first time I tried to run the command “git” I was prompted to install the command line tools. Then I just ran ./configure && make && make install on MacPorts and it works.

  7. This might not be the right place to ask this, however, what theme are you using in WordPress for this site, just curious?

    1. The theme is called Twenty Ten, and the header picture is an IR + Deep Blue photo I took last year of the mountains surrounding the Black Rock Desert.

  8. Just as an FYI after updating to official Mavericks last night:
    find /Applications/ -iname ''

    You won’t get any results even after launching Xcode. This is because Xcode is just not automatically updates for you. You still need to do that manually in order to get all of the appropriate library installations.

    So, it’s pretty simple:
    – Open the App Store
    – Make sure you do an Update All to get the latest Xcode and the OS update (on an older machine and throttled network connection this took around 25 minutes in total)
    – After doing this I still needed the TCL flags for the CC run
    – Execute the instructions on the page and you should be fine

    1. Yes, just installing Xcode will not put in the place where MacPorts expects it. Only running xcode-select –install will do that and allows skipping the configure flags. Installing Xcode will not automatically install the command line tools!

      1. I’ve added xcode-select –install to the instructions. I’m installing the release version of Mavericks onto a VM right now so I can test getting rid of the tcl options.

        Thank you for your suggestions. Now, can I bug you about dsniff-devel? “)

        1. Since I’m the MacPorts maintainer for dsniff-devel, as a matter of a fact, you can. Are there any problems with it on Mavericks? Can you file a bug and Cc me?

      2. When I run xcode-select -install I get a usage message: xcode-select: error: invalid argument '-install' and is not in /System/Library/…

        I’ve updated Xcode in the App Store and have clicked “Check and Install Now” in Xcode > Preferences > Downloads. Any ideas what I’m doing wrong?

          1. Ahh, looking through my command history I found I made a typo and ran xcode-select --instsall by mistake 🙁

            What threw me off is that the complete usage message I got from xcode-select does not list the --install option.

            xcode-select: error: invalid argument '--instsall'
            Usage: xcode-select [options]

            Print or change the path to the active developer directory. This directory
            controls which tools are used for the Xcode command line tools (for example,
            xcodebuild) as well as the BSD development commands (such as cc and make).

            -h, --help print this help message and exit
            -p, --print-path print the path of the active developer directory
            -s , --switch set the path for the active developer directory
            -v, --version print the xcode-select version
            -r, --reset reset to the default command line tools path


  9. Thanks for this Chris, very helpful. One thing to add, if installing MacPorts on a fresh Mavericks system, you’ll also need to add /opt/local/bin and /opt/local/sbin to your $PATH (before running “port -dv selfupdate”).

    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    to the .profile file in your home directory will do it.

  10. Thanks for the wonderful instructions. Got me up and running in no time after my upgrade to Mavericks.

  11. make failed for me with the following error:

    Any thoughts?

    readline.c:127:23: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
    readline.c:48:39: note: expanded from macro 'USERNAME_COMPLETION_FUNCTION'
    # define USERNAME_COMPLETION_FUNCTION username_completion_function
    /Users/sean/anaconda/include/readline/readline.h:449:14: note: 'rl_username_completion_function' declared here
    extern char *rl_username_completion_function PARAMS((const char *, int));
    1 error generated.
    make[2]: *** [readline.o] Error 1
    make[1]: *** [all] Error 1
    make: *** [all] Error 1

  12. The version of Xcode released via the App Store at the same time as the Mavericks release no longer seems to have an option to download the command-line tools. The only way I could see to install them was to download from:

    Moreover, as that page indicates, there are several additional downloads of Xcode tools that had been part of Xcode itself in former versions but now must be downloaded and added separately, if needed.

    1. The shell command xcode-select --install will pop up a dialog box requesting permission to install the command line utilities. Have you tried that?

  13. For the hardcore haxxors who use iTerm2 instead of Apple terminal, you will be unable to click the install button after running the xcode-select --install, until you actually start and accept the license agreement.
    The easiest way is just to run the xcode-select --install command from inside and not from inside iTerm2.

  14. Thanks for these instructions. I’m moving to macports rather than mess about getting fink running on 10.9. This page sped me along the install.

    My install steps were:

    1. Allow XCode to update/install additional packages by launching XCode and checking the Preferences.
    2. “xcode-select –install”
    3. “./configure –enable-readline”
    4. “make”
    5. “sudo make install”

    I also found that I needed to “sudo chmod a+rx /opt/local/share/macports/Tcl” to address a permissions issue when running “port” as a non-root user.

  15. Following your instructions, I get an error message while running the ./configure command:

    checking whether tclsh was compiled with threads… no
    configure: error: tcl wasn’t compiled with threads enabled

    Any idea on how to get rid of that?

    1. This probably means it picks up the wrong Tcl installation. This could be tcl from MacPorts itself, or some other paths such as /usr/local. Try to remove anything unrelated from your PATH temporarily.

      export PATH=/usr/bin:/bin:/usr/sbin:/sbin
      sudo make install

      Then just open a new terminal window to return to your default environment.

      1. Thanks a lot! You were right: it was using Tcl from an old fink installation. I cleaned up the PATH variable from all unnecessary stuff and it worked perfectly.

  16. Thank you sir. Scholar and a gent.

    Had a permissions issue on some of the port working directories, but I just blew those away as they arose and all looks good.

  17. This helped quite a bit, huge thanks!
    One thing that may be of help to others who have a symlink to there /opt directory is to provide the full path in their macports.conf

    So if /opt is really a symlink to /Users/yourusername/opt

    then inside /opt/local/etc/macports/macports.conf change all the paths from /opt/local to the true path of /Users/yourusername/opt

    Unless there’s a better way, this is what I needed. Hope it helps!

  18. Thanks much! Went to build the code in our Maven repo and no more mvn in Mavericks! Tried to install via MacPorts and MacPorts is dead!

    Back in business now.

  19. Thanks a lot, Chris! These instructions worked perfectly and got me back up and running in no time!

  20. what should i do about this error?

    Error: for port sumo returned: command execution failed
    Please see the log file for port sumo for details:
    To report a bug, follow the instructions in the guide:
    Error: Processing of port sumo failed

  21. I would like to thank, first, Mr. Chris Knight putting up this solution. Next I would like to thank those individuals that posted, on this page, suggestions to enhance Chris’s original work.

    I’m happy to report that my MacPorts are up and running as expected, so I’m back in business!

    Thank you,


Leave a Reply to Pascal Cancel reply

Your email address will not be published.

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