iSALE on MacOS - isale-code/isale-wiki GitHub Wiki
We now recommend using homebrew to install and manage packages:
Visit the Homebrew website or run the command below.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install gcc
This should install both gcc and gfortran.
We now recommend installing python using conda:
brew install miniconda
Once conda
is installed we suggest that you create a conda environment to use with iSALE. To do this, you will need to create a environment.yml
file in the isale-dev directory. An example environment file would be:
name: iSALE311
channels:
- defaults
- conda-forge
dependencies:
- python=3.11
- pip
- ipython
- jupyter
- numpy
- scipy
- pip:
- -r requirements.txt
Open an empty file environment.yml
in a text editor and paste the above into the file before saving. Make sure you save the environment file in the isale-dev directory and change into that directory. Then you can create the conda environment with:
conda init zsh
conda env create -f environment.yml
Now, whenever you wish to use pySALEPlot you will need to activate this environment:
conda activate iSALE311
You can then configure
, make
and make install
iSALE in the standard way.
With the move to High Sierra, gcc4.9
is no longer supported. The method described here installs gcc7
and is sufficient to get iSALE
and pySALEPlot
working on your High Sierra mac.
Note: I have not tried to install vimod
(cannot get qt3
to work with gcc
versions 5 and above) or iSALEPlot
(as it is obsolete now we have pySALEPlot
)
xcode-select --install
If you have an existing MacPorts installation, follow the migration guidelines here: https://trac.macports.org/wiki/Migration
- Install MacPorts base for 10.13 High Sierra from here: https://www.macports.org/install.php
- (Optional) generate a list of your installed ports, so you can reinstall them all later, if required (e.g.
port -qv installed > myports.txt
) - Remove all installed ports:
sudo port -f uninstall installed sudo port clean all
Download and install XQuartz from here: http://xquartz.macosforge.org/landing/
You will need to logout and back in again after this.
Here we'll also install some necessary packages for pySALEPlot
to work. ipython
is not necessary, but recommended.
sudo port install python27 sudo port select --set python python27 sudo port install py27-matplotlib sudo port install py27-numpy sudo port install py27-scipy sudo port install py27-ipython
Note that if the version of matplotlib
you install is lower than 2.1.1, then you will also need to install tkinter
:
sudo port install py27-tkinter
First install gcc
. As of Nov 2017, this installs gcc 7.2.0
, which seems to work fine for iSALE.
sudo port install gcc7
Tell your mac to use this gcc
version and not the Xcode version.
sudo port select --set gcc mp-gcc7
At this point, check you are using the correct version by running gcc -v
or gfortran -v
. It should tell you that you are using the MacPorts version here. If you see that it is the Xcode version, try selecting it again, or restarting the terminal.
If you are installing iSALE3D, you probably want to install openmpi
so you can run in parallel.
sudo port install openmpi sudo port select --set mpi openmpi-mp-fortran
The iSALE manual is written in LaTeX and requires pdflatex
to compile it. Developers wishing to edit and compile an up-to-date manual for the trunk should install MacTeX (http://www.tug.org/mactex/index.html). Note this is a large package and is best installed over a fast network connection
At this point you should be ready to install iSALE in the standard way.
With the move to Yosemite, gcc 4.5 is no longer supported, so the installation instructions have changed a little to compile with gcc 4.8 or 4.9. Here is the method I used to get iSALE, vimod and iSALEPlot working on Yosemite. The same method works for El Capitan and Sierra.
xcode-select --install
If you have an existing MacPorts installation, follow the migration guidelines here: https://trac.macports.org/wiki/Migration
- Install MacPorts base for 10.10 Yosemite from here: https://www.macports.org/install.php
- (Optional) generate a list of your installed ports, so you can reinstall them all later, if required
- Remove all installed ports:
sudo port -f uninstall installed sudo port clean all
Download and install XQuartz from here: http://xquartz.macosforge.org/landing/
You will need to logout and back in again after this.
sudo port install python27 sudo port select --set python python27 sudo port install py27-matplotlib sudo port install py27-numpy sudo port install py27-scipy
Note, installing pgplot before gcc means that gcc 4.9 (gcc49) is installed by macports. This is fine, but means we need to make a small fix to qt3 (see step 9). (also note, when Yosemite was first released (~Oct 2014), this step installed gcc 4.8. As of Jan 2015, it installs gcc 4.9. Both seem to work equally well).
sudo port install pgplot
This step is necessary, otherwise the Xcode version will be used, and this causes lots of problems later.
sudo port select --set gcc mp-gcc49
At this point, check you are using the correct version by running gcc -v
or gfortran -v
. It should tell you that you are using the MacPorts version here. If you see that it is the Xcode version, try selecting it again, or restarting the terminal.
Now we have gcc, we need to install qt3. The best way (and the only way supported by the iSALE development team) is to do this through MacPorts:
sudo port install qt3
Because we are using gcc49, there is a bug in qt3, which is unlikely to ever get fixed upstream. So, we have to do it by hand here. Edit the file ‘qvaluelist.h’ in /opt/local/include/qt3 (assuming your MacPorts is installed in the standard location), using your favourite text editor:
sudo vim /opt/local/include/qt3/qvaluelist.h
and add the line:
#include
to the header. I did this after the line #define QVALUELIST_H
. I’m not sure how important its placement is, but that worked for me
You may also want to install gnuplot
and openmpi
(for all tests to pass).
sudo port install gnuplot sudo port install py27-ipython sudo port install openmpi sudo port select --set mpi openmpi-mp-fortran
The iSALE manual is written in LaTeX and requires pdflatex
to compile it. Developers wishing to edit and compile an up-to-date manual for the trunk should install MacTeX (http://www.tug.org/mactex/index.html). Note this is a large package and is best installed over a fast network connection
At this point you should be ready to install iSALE in the standard way.
This is not automatically installed, but should come with your Mac on the OS installation disk for 10.6. For 10.7/8, you can install Xcode through the App Store. Once it is installed, run it once and install any updates/extensions when prompted. Finally, install the "command line utilities," from Preferences -> Downloads. Once this is installed you can close Xcode and should not need it again!
It is recommended to install this using the package here: http://xquartz.macosforge.org/landing/ I think you will need to logout and back in again after this. Mac OSX 10.6 comes with X11 pre-installed, so this step is not required.
Follow the instructions here: http://www.macports.org/install.php It is recommended to install using the pkg installer for Lion/Mountain Lion
To install a package using macports:
sudo port install
where is an available port (see: http://www.macports.org/ports.php) For example,
sudo port install python27
In some instances, where multiple versions of software exist on the machine, it may be necessary to select the correct version. After installing, the available versions can be listed with
sudo port select --list
For example,
sudo port select --list python
might return
Available versions for python: none (active) python25-apple python26-apple python27 python27-apple
The correct software version can then be selected with
sudo port select
For example,
sudo port select python python27
The following sequence of ports should install and select all the necessary software required to install and run iSALE:
GNU fortran and c compilers (required by all)
sudo port install gcc45 sudo port select gcc mp-gcc45
Note: at this point it is worth verifying that the gcc compiler just installed has been correctly selected by invoking
gcc --version
. If this command returns version number 4.2.X this may be because theport select
command was not successful. In this case, establish where gcc is located usingwhich gcc
; if the result is/usr/bin/gcc
then one solution is to remove (or rename) this link (sudo rm /usr/bin/gcc
). At this point,which gcc
should return/opt/local/bin/gcc
(i.e., the macports-installed version) andgcc --version
should return 4.5.X
Python and supporting modules (required for pySALEPLot)
sudo port install python27 sudo port select python python27 sudo port install py27-ipython sudo port install py27-scipy sudo port install py27-matplotlib
GNUplot (required for some tests and simple data output)
sudo port install gnuplot
PGPLOT graphics library (required for iSALEPlot)
sudo port install pgplot
Qt3 (required for VIMoD)
sudo port install qt3
openmpi for parallel simulations
sudo port install openmpi sudo port select mpi openmpi-mp-fortran
The iSALE manual is written in LaTeX and requires pdflatex
to compile it. Developers wishing to edit and compile an up-to-date manual for the trunk should install MacTeX (http://www.tug.org/mactex/index.html). Note this is a large package and is best installed over a fast network connection
At this point you should be ready to install iSALE in the standard way.
It is possible that you have a different version of libpng installed on your Mac than the one in macports. If this is the case, iSALEPlot may appear to compile ok, but then will not run, and give an error that looks something like:
libpng warning: Application built with libpng-1.X.x but running with 1.Y.y Segmentation fault: 11
In this case, iSALEPlot has been build with a different version of libpng (1.Y.y) to the version used to build the macports version of pgplot (1.X.x), and thus iSALEPlot will not work. To fix this, rerun the configure script as normal, but add the following option:
--with-libpng=/opt/local/lib/libpng.a
Assuming that you macports is installed to the default location (/opt/local/lib/), this should fix the problem.