Thursday, 11 March 2010

MacPorts, Xcode, gnuplot

[Post published by Liviu on Liviu's [Computer Science] Blog]


Problems on a Mac OS X 10.5:

P1: One needs to install on Mac OS X commands like calc, wget (although Mac offers the equivalent curl) etc.

P2: One needs to install gnuplot (wikipedia on gnuplot), but would prefer not to go through all the steps (i.e. configure, compile etc.) with the source code of gnuplot.


    Solution:

    First, install MacPorts. According to Wikipedia, DarwinPorts has become MacPorts - I recommend the easiest installation possible, i.e. Mac OS X Package (.pkg) Installer.

    Second, get familiarized to using MacPorts, by reading that specific part of the manual describing the port command.

    From now on, you should install the piece of software causing your problem:


    P1: calc, wget etc.
    sudo port install calc
    sudo port install wget 


    P2: gnuplot (It will be installed in the same way as above, but I encountered a few problems)

    When I first tried to install it, I encountered an error:
    On Mac OS X 10.5, gnuplot 4.2.5 requires Xcode 3.1 or later but you have Xcode 3.0.
    Error: Target org.macports.extract returned: incompatible Xcode version
    Error: Status 1 encountered during processing.

    , so I cleaned the failed installation:
    port clean --all gnuplot

    Given the error, I uninstalled Xcode 3.0 (pages on uninstalling Xcode: 1, 2, 3) and installed Xcode 3.1.4 which I've downloaded from Apple.

    Then I ran the selfupdate for MacPorts
    sudo port selfupdate
    and checked for outdated ports
    port outdated
    but there weren't any, so there was no need to upgrade any installed ports.

    Should you find any outdated ports, just run (as it recommends when finds those outdated ports)
    sudo port upgrade outdated
    You can also use the other command, which tries to upgrade all installed ports
    sudo port upgrade installed


    Then I finally installed gnuplot
    sudo port install gnuplot
    in order to upgrade all your installed ports and their dependencies.

    Feel free to check its man page, or type gnuplot in terminal etc.

    End.

    4 comments:

    Mircea said...

    Yey, another MacPorts user :) Enjoy.

    (Compiling stuff indeed takes a while. I keep remembering this while thinking of installing Mac OS X 10.6)

    Liviu said...

    Well, I had to google quite a lot before discovering that solution...

    So, do you have some other essential tips I should be aware about?

    Mircea said...

    You might also like Porticus (http://porticus.alittledrop.com/), as a GUI for MacPorts (even though the CLI version works all the time, some sort of visualization could help).

    I personally look for Mac OS X applications on http://osx.iusethis.com/ and use AppFresh (http://osx.iusethis.com/app/appfresh) to check if they are outdated (does not always work).

    Of course, the CLI-style of upgrading packages (Linux distributions, MacPorts/Fink) works better, but some native Mac OS X apps are not available through MacPorts (especially non-open source apps).

    Good luck.

    Liviu said...

    Thank you for the tips.