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.
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):
- Open the App Store and install XCode (free)
- Open Xcode, go to Preferences/Download, and install Command Line Tools
- 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 - Install the downloaded macports by opening the .pkg file
- Open a Terminal window (Applications/Utilities/Terminal) and run
- Run
- Run
- Run octave by running the command
octave
in the terminal. - To install octave packages you can install them in the Octave environment :
pkg install -forge miscellaneous struct general optim
- addpath In case you're having problems actually using the octave-forge packages, you might need to create/edit your ~/.octaverc along the lines of
- X11/Xquartz - setting DISPLAY At this point
sudo port -v selfupdate
sudo port install gnuplot maxima vim nano xtermwhich will take a while -- it needs to set up the build environment from scratch 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.
sudo port install octave-devel qtoctave-macwhich 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)
addpath('/Users/verahill/octave/optim-1.2.2')Replace verahill with the proper user name, and edit the version number as needed.
gave nothing, and trying to launch an X11 program (e.g. xterm) complained that DISPLAY was not set. Setting DISPLAY manually (export DISPLAY=:0.0) didn't help either.echo $DISPLAY
'Bad' solution: the first solution was to install xorg-server (sudo port install xorg-server), and then manually
orX & export DISPLAY=:0.0
Both X and Xquartz come from macports.Xquartz & export DISPLAY=:0.0
Good solution
I then tried to change tack and went to http://xquartz.macosforge.org/landing/ and downloaded XQuartz-2.7.4.dmg (I was originally under the impression that it came as default with "mountain lion" but no.).
Open the file, then run the .pkg file in that archive. Log out of OSX, then log in again. Now try launching e.g. xterm form a terminal and it should work.
The entire process will 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 -- compiling stuff is ALWAYS exciting.
No comments:
Post a Comment