What is it?
Install (without being root!)
apt-get, …): version is outdated.
From scratch (advanced users)
Source code are available on Onelab’s Gitlab and GMSH can be compiled by hand.
Direct install (recommended)
The easiest way to install GMSH is to simply download the binary files for Linux/Windows/Mac, either Stable or Latest automatic Gmsh snapshot (recommended (by me)). The binary file
gmsh is located in
bin/gmsh in the compressed downloaded file. You can launch it directly
cd folder/of/gmsh/bin ./gmsh
Apart from (maybe) the color theme, a new window should have been launched and looks like this
gmsh to your
usr/bin. This folder is reserved to your package manager.
For Linux (and Mac) users, it might be convenient to be able to launch GMSH in a terminal and from whichever folder. To do that, simply add to the
$PATH environment variable, the path to
gmsh’s folder. This can be automated by adding a line in
$HOME/.profile or …)
You must rerun your shell to get the changes applied (or usr
[Beginnner] How to manage your files?
A question that quickly arises is:
Where and how do I store every binary and lib files without making my computer a full mess?
There are multiple answers and here you’ll find one which you may like (or not). I like to have a
$HOME/install folder (local to my account, thus) which mimic the
/usr/ folder, i.e. containing
$HOME/install └── bin/ # binary files └── gmsh #some binaries (gmsh, ...) └── lib/ # library files └── gmsh.py └── libgmsh.so └── share/ # dynamic libraries └── include/ # header files
I then set the
$PATH environment variable to
Every time I add a new file to
$HOME/install/bin it becomes accessible, without having to change the environment variable.
Actually I have three main folders
$HOME/src: Source codes
$HOME/build: Where the source codes are compiled
$HOME/install: Installed software that I either compiled or downloaded
This way, source code, build process and installed file are well separated.
Local in the folder (meh)
For example on Unix system and for Python, a way to install it locally (without being root) and by hand ("à la hussarde") is to add this in this in the header of your Python file
import sys sys.path.insert(0, "/path/to/sdk/lib") import gmsh
Permanent linking (better)
A better method is to use the
$PYTHONPATH environment variable and set it to the SDK’s folder. Following the previous paragraph, create a folder
install at your
$HOME folder and copy the content of
lib folder of the SDK’s zip file inside
$HOME/install/lib. You would then have this stucture
$HOME/install └── lib/ # library files └── gmsh.py └── libgmsh.so
You have now to add to Python the path:
A relaunch of the terminal might be necessary to take these changes into account. In your Python code, you juste have to import
gmsh without any other condition
bin/gmshcontained in the SDK’s zip file might not work as a standalone binary file. Please download and use the binary provided by GMSH’s website for that use.
Software Development Toolkit ↩︎