发现这个工具似乎很好用Homebrew
Quick jot for memory on how to install octave + scientific python for Mountain Lion, since it's pretty new for now .. These steps are kind of a mess since I'm not really documenting them in sequence.
1. Install Xcode 4.5 + command line tools
2. Install homebrew
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
3. Test to make sure everything's okay
$ brew doctor
$ brew update
4. Get Mountain Lion and Homebrew to Be Happy
Visit http://xquartz.macosforge.org/trac/wiki and download and install 2.7.2+.
5. Install python using homebrew (will take a long time)
$ brew install python
6. Make sure python is at /usr/local/bin/python
$ which python
7. Install pip for python
$ easy_install pip
8. Install gfortran using homebrew
$ brew install gfortran
If this gives the error message:
Currently the gfortran compiler provided by this brew is only supports
the following versions of XCode
- XCode 3.1.4 on OS X 10.5.x
- XCode 3.2.2/3.2.3 -- 4.0 on OS X 10.6.x
- XCode 4.1 or newer on OS X 10.7.x
etc.
then
$ brew edit gfortran
replace
if MacOS.xcode_version >= '4.2' and MACOS_VERSION > 10.7
ohai "Installing gfortran 4.2.4 for XCode 4.2 (build 5666)"
with
if MacOS.xcode_version >= '4.2' and MACOS_VERSION >= 10.7
ohai "Installing gfortran 4.2.4 for XCode 4.2 (build 5666) or higher"
(not necessary once the gfortran recipe is updated by homebrew)
9. Install scipy and numpy using pip
$ sudo pip install scipy
$ sudo pip install numpy
10. Install pkg-config using homebrew
$ brew install pkg-config
11. Install gcc using homebrew (not necessary?)
$ brew install gcc --use-llvm
12. Install matplotlib
From http://practicalcomputing.org/node/69:
$ sudo mkdir -p /usr/local/include
$ sudo ln -s /usr/X11/include/freetype2/freetype /usr/local/include/freetype
$ sudo ln -s /usr/X11/include/ft2build.h /usr/local/include/ft2build.h
$ sudo ln -s /usr/X11/include/png.h /usr/local/include/png.h
$ sudo ln -s /usr/X11/include/pngconf.h /usr/local/include/pngconf.h
$ sudo ln -s /usr/X11/include/pnglibconf.h /usr/local/include/pnglibconf.h
$ sudo mkdir -p /usr/local/lib
$ sudo ln -s /usr/X11/lib/libfreetype.dylib /usr/local/lib/libfreetype.dylib
$ sudo ln -s /usr/X11/lib/libpng.dylib /usr/local/lib/libpng.dylib
Finally
$ sudo pip install matplotlib-1.1.1.tar.gz
$ brew install fltk
If fltk cannot be installed with the following error
Error: Failed executing: make install (fltk.rb:24)
Then just install octave without fltk first (it's not crucial) .. until it's fixed
$ brew install --with-magick-plus-plus GraphicsMagick
$ brew install octave --without-fltk
$ brew install gnuplot
If you get this error while compiling Octave:
sed: RE error: illegal byte sequence
...
Error: Failed executing: make all (octave.rb:84)
Then unset the LANG environmental variable first
$ unset LANG
14. MacTeX, TeXShop and LyX
Finally, something that can be easily installed ..
http://pages.uoregon.edu/koch/texshop/obtaining.html
1. Install Xcode 4.5 + command line tools
2. Install homebrew
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
3. Test to make sure everything's okay
$ brew doctor
$ brew update
4. Get Mountain Lion and Homebrew to Be Happy
Visit http://xquartz.macosforge.org/trac/wiki and download and install 2.7.2+.
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
$ ln -s /opt/X11 /usr/X115. Install python using homebrew (will take a long time)
$ brew install python
6. Make sure python is at /usr/local/bin/python
$ which python
7. Install pip for python
$ easy_install pip
8. Install gfortran using homebrew
$ brew install gfortran
If this gives the error message:
Currently the gfortran compiler provided by this brew is only supports
the following versions of XCode
- XCode 3.1.4 on OS X 10.5.x
- XCode 3.2.2/3.2.3 -- 4.0 on OS X 10.6.x
- XCode 4.1 or newer on OS X 10.7.x
etc.
then
$ brew edit gfortran
replace
if MacOS.xcode_version >= '4.2' and MACOS_VERSION > 10.7
ohai "Installing gfortran 4.2.4 for XCode 4.2 (build 5666)"
with
if MacOS.xcode_version >= '4.2' and MACOS_VERSION >= 10.7
ohai "Installing gfortran 4.2.4 for XCode 4.2 (build 5666) or higher"
(not necessary once the gfortran recipe is updated by homebrew)
9. Install scipy and numpy using pip
$ sudo pip install scipy
$ sudo pip install numpy
10. Install pkg-config using homebrew
$ brew install pkg-config
11. Install gcc using homebrew (not necessary?)
$ brew install gcc --use-llvm
12. Install matplotlib
From http://practicalcomputing.org/node/69:
$ sudo mkdir -p /usr/local/include
$ sudo ln -s /usr/X11/include/freetype2/freetype /usr/local/include/freetype
$ sudo ln -s /usr/X11/include/ft2build.h /usr/local/include/ft2build.h
$ sudo ln -s /usr/X11/include/png.h /usr/local/include/png.h
$ sudo ln -s /usr/X11/include/pngconf.h /usr/local/include/pngconf.h
$ sudo ln -s /usr/X11/include/pnglibconf.h /usr/local/include/pnglibconf.h
$ sudo mkdir -p /usr/local/lib
$ sudo ln -s /usr/X11/lib/libfreetype.dylib /usr/local/lib/libfreetype.dylib
$ sudo ln -s /usr/X11/lib/libpng.dylib /usr/local/lib/libpng.dylib
If you get the error:
unable to execute clang++: No such file or directory
then do
$ sudo ln -s /usr/bin/clang /usr/bin/clang++Finally
$ sudo pip install matplotlib-1.1.1.tar.gz
13. Install octave (will take a long time)
$ brew install fltk
If fltk cannot be installed with the following error
Error: Failed executing: make install (fltk.rb:24)
Then just install octave without fltk first (it's not crucial) .. until it's fixed
$ brew install --with-magick-plus-plus GraphicsMagick
$ brew install octave --without-fltk
$ brew install gnuplot
If you get this error while compiling Octave:
sed: RE error: illegal byte sequence
...
Error: Failed executing: make all (octave.rb:84)
Then unset the LANG environmental variable first
$ unset LANG
14. MacTeX, TeXShop and LyX
Finally, something that can be easily installed ..
http://pages.uoregon.edu/koch/texshop/obtaining.html
Useful references: