5 Şubat 2013 Salı

327. Installing Octave, Gnuplot on OSX 10.8.2 via macports

To contact us Click HERE
NOTE: while on the surface this has little to do with linux, it IS in our interest to get people on other platforms to use the same tools we do. Or at least compatible ones. So knowing about macports will help even the most die-hard linux user. In fact, it will help especially those.

NOTE2: I haven't tried it yet (I don't have a 'Mac') but the octave-forge pkg issues below would probably be resolved by install octave-devel (3.6.3) instead of octave (3.2.1) in which case you can simply download everything from the octave-forge site instead. The packages there aren't compatible with octave 3.2, since it's too old.


I'm no friend of Apple, Mac or OS X for many reasons (restrictive environment, weird mouse, their typical target audience), but pragmatism will make you happier than zealotry. What doesn't work for me obviously works for other people.

Students (and professors) at Australian universities do use apple laptops in significant number though (yet our ERP system only works properly with Internet Explorer -- try requesting leave using chrome on linux and you may be in for a surprise) so I've recently been faced with the issue of installing my standard linux tools on students' apple laptops. In fact it's gotten so bad that several Australian universities 'give' ipads to all their students for 'free' (nothing is free when you're paying for it through your tuition). As someone working at a uni I resent this since, by using the one platform where you can't install what you want on it, this puts pressure on me to restrict my teaching to what can be had via the almighty app store. (there's a lot of BS about blended learning, and you'd be lucky to find a white board anywhere. Blackboards are completely gone which is idiocy of the first degree)

Anyway. There's plenty of people here using Macbook-thingies and it's in my own interest to get them on the narrow path to justice, liberty and the FOSS way.

Macports is a really cool package manager/repository for linux software for Mac OSX and works by compiling the software from the sources -- pretty much how I imagine that the Gentoo experience may be like. Anyway, it works fine although it takes a fair amount of time to install things.


So here's how to do it (no screenshots because I'm typing this from memory):
  1. Open the App Store and install XCode (free)
  2. Open Xcode, go to Preferences/Download, and install Command Line Tools
  3. Download macports via this link for OS X 10.8: https://distfiles.macports.org/MacPorts/MacPorts-2.1.2-10.8-MountainLion.pkg
    Other versions of OS X are also supported, see here: http://www.macports.org/install.php
  4. Install the downloaded macports by opening the .pkg file
  5. Open a Terminal window  (Applications/Utilities/Terminal) and run
  6. sudo ports -v selfupdate
  7. Run
  8. sudo ports install gnuplot
    which will take a while -- it needs to set up the build environment from scfatch in addition to regular dependencies. Set aside an hour or so just in case. If there's an error, try running the command once more.

  9. Run
  10. sudo ports install octave
    which will take a long while. If the compile seems to have stopped, checked the titlebar of the terminal window -- the command it's executing will continously change during the compile)

  11. Run octave by running the command
    octave
    in the terminal.
  12. To install octave packages you can install them via macports in the terminal environment like a good Linux kid:
    sudo ports install octave-miscellaneous octave-struct octave-optim
    Note: RIGHT NOW octave-general doesn't install which prevents optim from being installed.
  13. QTOctave: according to what I found online  you should edit your ~/.octaverc file and put
    setenv("GNUTERM","X11")
    to be able to plot in qtoctave (plotting in octave launched from the terminal is fine). I had no luck with it. Setting it in the program didn't help either. Possibly you need to look at 2.1.1 here: http://guide.macports.org/#installing.x11

Things that don't work at the moment (25 Jan 2013):
* octave forge packages that depend on octave-general won't install until octave-general has been fixed. That'd be most packages.
* macports octave is too old for the octave-forge packages online.
* I personally haven't figured out the X11 settings.

It'll take well over an hour, but at the end of it you'll have Octave, Gnuplot AND a complete build environment! 
And there are plenty more things you can install with macports (e.g. qtoctave (qtoctave-mac), gedit (gedit gedit-plugins), kile, maxima, qtiplot).

Not sure why I am so excited over it since all these things are available in most linux repos, but there you go. 

Hiç yorum yok:

Yorum Gönder