MacOS – Installing ghostscript using MacPorts fails

installmacosmacportsxcode

I recently upgraded MacOSX to version 10.9. Before I did that, i uninstalled all macports-packages using:

sudo port uninstall --follow-dependencies installed

Now I'm running MacPorts 2.2.1 and Xcode 5.0.2 is installed On my Computer. I'd like to install ghostscript (actually I'd like to install inkscape, but the installation of ghostscript fails) using the following command:

sudo port install ghostscript

But I receive the following error:

--->  Extracting ghostscript
Error: org.macports.extract for port ghostscript returned: command execution failed
Please see the log file for port ghostscript for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port ghostscript failed

The last lines of the log file (cat /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/main.log) contain:

:debug:main Executing org.macports.main (ghostscript)
:debug:main Skipping completed org.macports.archivefetch (ghostscript)
:debug:main Skipping completed org.macports.fetch (ghostscript)
:debug:main Skipping completed org.macports.checksum (ghostscript)
:debug:extract extract phase started at Tue Dec 17 13:31:36 CET 2013
:notice:extract --->  Extracting ghostscript
:debug:extract Executing org.macports.extract (ghostscript)
:info:extract --->  Extracting ghostscript-9.10.tar.gz
:debug:extract setting option extract.args to '/opt/local/var/macports/distfiles/ghostscript/ghostscript-9.10.tar.gz'
:debug:extract Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.9'
:debug:extract Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/ghostscript/ghostscript-9.10.tar.gz' | /usr/bin/gnutar --no-same-owner -xf -'
:debug:extract Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/ghostscript/ghostscript-9.10.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
:info:extract sh: /usr/bin/gnutar: No such file or directory
:info:extract gzip: error writing to output: Broken pipe
:info:extract gzip: /opt/local/var/macports/distfiles/ghostscript/ghostscript-9.10.tar.gz: uncompress failed
:info:extract Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/ghostscript/ghostscript-9.10.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
:info:extract Exit code: 127
:error:extract org.macports.extract for port ghostscript returned: command execution failed
:debug:extract Error code: NONE
:debug:extract Backtrace: command execution failed
    while executing
"$procedure $targetname"
:info:extract Warning: targets not executed for ghostscript: org.macports.activate org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
:notice:extract Please see the log file for port ghostscript for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_print_ghostscript/ghostscript/main.log

I couldn't find out what wrong,…

Best Answer

The problem is that macports is trying to use /usr/bin/gnutar, but can't find it. I think this happens because your version of macports was not built for mavericks, and therefore doesn't know where the tools (such as gnutar) actually are. There are different versions of macports 2.2.1, depending on your version of OS X.

You should reinstall macports (for mavericks) from the binary here: https://distfiles.macports.org/MacPorts/MacPorts-2.2.1-10.9-Mavericks.pkg

you should probably also run xcode-select --install