1.. default-domain:: dynare
2
3##############################
4Installation and configuration
5##############################
6
7Software requirements
8=====================
9
10Packaged versions of Dynare are available for Windows (7, 8.1, 10), several GNU/Linux
11distributions (Debian, Ubuntu, Linux Mint, Arch Linux) and macOS
1210.11 or later. Dynare should work on other systems, but some compilation steps
13are necessary in that case.
14
15In order to run Dynare, you need one of the following:
16
17* MATLAB version 7.9 (R2009b) or above;
18* GNU Octave version 4.2.1 or above, with the statistics package from
19  `Octave-Forge`_. Note however that the Dynare installers for Windows and
20  macOS require a more specific version of Octave, as indicated on the download
21  page.
22
23The following optional extensions are also useful to benefit from
24extra features, but are in no way required:
25
26* If under MATLAB: the Optimization Toolbox, the Statistics Toolbox,
27  the Control System Toolbox;
28
29* If under Octave, the following `Octave-Forge`_ packages: ``optim, io,
30  control``.
31
32
33Installation of Dynare
34======================
35
36After installation, Dynare can be used in any directory on your
37computer. It is best practice to keep your model files in directories
38different from the one containing the Dynare toolbox. That way you can
39upgrade Dynare and discard the previous version without having to
40worry about your own files.
41
42
43On Windows
44----------
45
46Execute the automated installer called ``dynare-4.x.y-win.exe`` (where
47``4.x.y`` is the version number), and follow the instructions. The
48default installation directory is ``c:\dynare\4.x.y``.
49
50After installation, this directory will contain several
51sub-directories, among which are ``matlab``, ``mex`` and ``doc``.
52
53The installer will also add an entry in your Start Menu with a
54shortcut to the documentation files and uninstaller.
55
56Note that you can have several versions of Dynare coexisting (for
57example in ``c:\dynare``), as long as you correctly adjust your path
58settings (see see :ref:`words-warning`).
59
60Also note that it is possible to do a silent installation, by passing the
61``/S`` flag to the installer on the command line. This can be useful when
62doing an unattended installation of Dynare on a computer pool.
63
64
65On GNU/Linux
66------------
67
68On Debian, Ubuntu and Linux Mint, the Dynare package can be installed with:
69``apt install dynare``. This will give a fully-functional Dynare installation
70usable with Octave. If you have MATLAB installed, you should also do: ``apt
71install dynare-matlab`` (under Debian, this package is in the ``contrib``
72section). Documentation can be installed with ``apt install dynare-doc``. The
73status of those packages can be checked at those pages:
74
75* `Package status in Debian`_
76* `Package status in Ubuntu`_
77* `Package status in Linux Mint`_
78
79On Arch Linux, the Dynare package is not in the official repositories, but is
80available in the `Arch User Repository`_. The needed sources can be
81downloaded from the `package status in Arch Linux`_.
82
83Dynare will be installed under ``/usr/lib/dynare``. Documentation will
84be under ``/usr/share/doc/dynare-doc`` (only on Debian, Ubuntu and Linux Mint).
85
86
87On macOS
88--------
89
90To install Dynare for use with MATLAB, execute the automated installer called
91``dynare-4.x.y.pkg`` (where *4.x.y* is the version number), and follow the
92instructions. The default installation directory is
93``/Applications/Dynare/4.x.y``. After installation, this directory will contain
94several sub-directories, among which are ``matlab``, ``mex``, and ``doc``.
95
96Note that several versions of Dynare can coexist (by default in
97``/Applications/Dynare``), as long as you correctly adjust your path
98settings (see :ref:`words-warning`).
99
100By default, the installer installs a version of GCC (for use with :opt:`use_dll`)
101in the installation directory, under the ``.brew`` folder. To do so, it also
102installs a version of `Homebrew <https://brew.sh>`__ in the same folder and
103Xcode Command Line Tools (this is an Apple product) in a system folder.
104
105All of this requires a bit of time and hard disk space. The amount of time it
106takes will depend on your computing power and internet connection. To reduce
107the time the Dynare installer takes, you can install Xcode Command Line Tools
108yourself (see :ref:`prerequisites-macos`). Dynare, Homebrew, and GCC use
109about 600 MB of disk space while the Xcode Command Line Tools require about 400
110MB.
111
112If you do not use the :opt:`use_dll` option, you have the choice to forgo the
113installation of GCC and hence Dynare will only take about 50 MB of disk space.
114
115Dynare for Octave works with Octave installed via the package located here:
116`https://octave-app.org <https://octave-app.org>`__.
117
118
119For other systems
120-----------------
121
122You need to download Dynare source code from the `Dynare website`_ and
123unpack it somewhere.
124
125Then you will need to recompile the pre-processor and the dynamic
126loadable libraries. Please refer to `README.md
127<https://git.dynare.org/Dynare/dynare/blob/master/README.md>`__.
128
129.. _compil-install:
130
131Compiler installation
132=====================
133
134Prerequisites on Windows
135------------------------
136
137There are no prerequisites on Windows. Dynare now ships a compilation
138environment that can be used with the :opt:`use_dll` option.
139
140
141Prerequisites on GNU/Linux
142--------------------------
143
144Users of MATLAB under GNU/Linux need a working compilation environment
145installed. Under Debian, Ubuntu or Linux Mint, it can be installed via ``apt
146install build-essential``.
147
148Users of Octave under GNU/Linux should install the package for MEX file
149compilation (under Debian, Ubuntu or Linux Mint, it can be done via ``apt
150install liboctave-dev``).
151
152.. _prerequisites-macos:
153
154Prerequisites on macOS
155----------------------
156
157Dynare now ships a compilation environment that can be used with the
158:opt:`use_dll` option. To install this environment correctly, the Dynare
159installer ensures that the Xcode Command Line Tools (an Apple product) have
160been installed on a system folder. To install the Xcode Command Line Tools
161yourself, simply type ``xcode-select --install`` into the Terminal
162(``/Applications/Utilities/Terminal.app``) prompt.
163
164Configuration
165=============
166
167For MATLAB
168----------
169
170.. highlight:: matlab
171
172You need to add the ``matlab`` subdirectory of your Dynare
173installation to MATLAB path. You have two options for doing that:
174
175
176* Using the ``addpath`` command in the MATLAB command window:
177
178  Under Windows, assuming that you have installed Dynare in the
179  standard location, and replacing ``4.x.y`` with the correct version
180  number, type::
181
182    >> addpath c:/dynare/4.x.y/matlab
183
184  Under GNU/Linux, type::
185
186    >> addpath /usr/lib/dynare/matlab
187
188  Under macOS, assuming that you have installed Dynare in the standard
189  location, and replacing ``4.x.y`` with the correct version number,
190  type::
191
192    >> addpath /Applications/Dynare/4.x.y/matlab
193
194  MATLAB will not remember this setting next time you run it, and you
195  will have to do it again.
196
197* Via the menu entries:
198
199  Select the “Set Path” entry in the “File” menu, then click on “Add
200  Folder…”, and select the ``matlab`` subdirectory of ‘your Dynare
201  installation. Note that you *should not* use “Add with
202  Subfolders…”. Apply the settings by clicking on “Save”. Note that
203  MATLAB will remember this setting next time you run it.
204
205
206For Octave
207----------
208
209You need to add the ``matlab`` subdirectory of your Dynare
210installation to Octave path, using the ``addpath`` at the Octave
211command prompt.
212
213Under Windows, assuming that you have installed Dynare in the standard
214location, and replacing “*4.x.y*” with the correct version number,
215type::
216
217  octave:1> addpath c:/dynare/4.x.y/matlab
218
219Under Debian, Ubuntu or Linux Mint, there is no need to use the ``addpath``
220command; the packaging does it for you. Under Arch Linux, you need to do::
221
222  octave:1> addpath /usr/lib/dynare/matlab
223
224Under macOS, assuming you have installed Octave via `https://octave-app.org
225<https://octave-app.org>`__, type::
226
227  octave:1> addpath /Applications/Dynare/4.x.y/matlab
228
229If you don’t want to type this command every time you run Octave, you
230can put it in a file called ``.octaverc`` in your home directory
231(under Windows this will generally be ``c:\Users\USERNAME`` while under macOS it is
232``/Users/USERNAME/``). This file is run by Octave at every startup.
233
234
235.. _words-warning:
236
237Some words of warning
238---------------------
239
240You should be very careful about the content of your MATLAB or Octave
241path. You can display its content by simply typing ``path`` in the
242command window.
243
244The path should normally contain system directories of MATLAB or
245Octave, and some subdirectories of your Dynare installation. You have
246to manually add the ``matlab`` subdirectory, and Dynare will
247automatically add a few other subdirectories at runtime (depending on
248your configuration). You must verify that there is no directory coming
249from another version of Dynare than the one you are planning to use.
250
251You have to be aware that adding other directories (on top of the
252dynare folders) to your MATLAB or Octave path can potentially create
253problems if any of your M-files have the same name as a Dynare
254file. Your routine would then override the Dynare routine, making
255Dynare unusable.
256
257
258.. warning::
259
260   Never add all the subdirectories of the ``matlab`` folder to the
261   MATLAB or Octave path. You must let Dynare decide which subdirectories
262   have to be added to the MATLAB or Octave path. Otherwise, you may
263   end up with a non optimal or un-usable installation of Dynare.
264
265
266.. _Package status in Debian: https://packages.debian.org/sid/dynare
267.. _Package status in Ubuntu: https://launchpad.net/ubuntu/+source/dynare
268.. _Package status in Linux Mint: https://community.linuxmint.com/software/view/dynare
269.. _Package status in Arch Linux: https://aur.archlinux.org/packages/dynare/
270.. _Arch User Repository: https://wiki.archlinux.org/index.php/Arch_User_Repository
271.. _Dynare website: https://www.dynare.org/
272.. _Dynare wiki: https://git.dynare.org/Dynare/dynare/wikis
273.. _Octave-Forge: https://octave.sourceforge.io/
274