For those who want to quickly have something running, this page explains how to
setup Dynare on Windows or macOS and to run your first
model (.mod
) file.
To run Dynare, you have the choice between running it on MathWorks MATLAB (proprietary) or GNU Octave (free software).
Windows
Using Dynare with MATLAB
- Make sure that MATLAB is installed on your computer.
- Download and install the latest Dynare package
- Open MATLAB
- Configure MATLAB for Dynare (see the section below)
- Run a Dynare example in MATLAB (see the section below)
Using Dynare with Octave
- Download and install the Octave installer
- Download and install the latest Dynare package
- Open Octave
- Configure Octave for Dynare (see the section below)
- Run a Dynare example in Octave (see the section below)
Configuring MATLAB for Dynare on Windows
You have two choices. You can either use the command window or the menu entries.
1. Configuring MATLAB using the Command Window on Windows
You will have to do this every time you start MATLAB, as MATLAB will not remember the setting.
- Click on the “Command Window”
- If you have Dynare installed in the standard location, type the following, replacing
x.y
with your Dynare version:>> addpath C:\dynare\x.y\matlab
For example, for Dynare 6.2 type:
>> addpath C:\dynare\6.2\matlab
2. Configuring MATLAB using the menu entries on Windows
You will only have to do this once as MATLAB will remember the setting the next time you run it.
- On the MATLAB
Home
tab, in theEnvironment
section, click onSet Path
- Click
Add Folder...
. Warning: DO NOT selectAdd with Subfolders...
- Select the
matlab
subdirectory of your Dynare installation. For example, if you have installed Dynare 6.2 in the standard location, select:C:\dynare\6.2\matlab
- Apply the setting by clicking
Save
button
Configuring Octave for Dynare on Windows
If you have Dynare installed in the standard location type the following at the Octave command prompt, replacing x.y
with your Dynare version:
Windows
>> addpath C:\dynare\x.y\matlab
For example, for Dynare 6.2 type:
>> addpath C:\dynare\6.2\matlab
If you don’t want to type this command every time you run Octave, you can put it in a file called .octaverc
in your home directory. This file will usually be called C:\Users\USERNAME\.octaverc
.
Running and editing a Dynare example on Windows
- Create a working directory that will hold your Dynare models. For example,
C:\dynare\work
. - Assuming that you are using Dynare 6.2, copy the example model file
C:\dynare\6.2\examples\example1.mod
to your working directory. - At the MATLAB or Octave command prompt, type the following to change the working directory:
>> cd C:\dynare\work
- Then type the following to run the example model file:
>> dynare example1
- You can edit the example by typing:
>> edit example1.mod
macOS
Using Dynare with MATLAB
- Make sure that MATLAB is installed on your computer.
- Download and install the latest Dynare package
- Open MATLAB
- Configure MATLAB for Dynare (see the section below)
- Run a Dynare example in MATLAB (see the section below)
Using Dynare with Octave
- Install Homebrew
- Install Dynare (and Octave) by typing the following in a terminal:
brew install dynare
- Open Octave by running the following in a terminal:
octave --gui
- Install some Octave add-ons from the Octave prompt (you only have to do it once)
>> pkg install -forge io statistics control struct optim
- Configure Octave for Dynare (see the section below)
- Run a Dynare example in Octave (see the section below)
Configuring MATLAB for Dynare on macOS
You have two choices. You can either use the command window or the menu entries.
1. Configuring MATLAB using the Command Window on macOS
You will have to do this every time you start MATLAB, as MATLAB will not remember the setting.
- Click on the “Command Window”
- If you have Dynare installed in the standard location, type the following, replacing
x.y
with your Dynare version:>> addpath /Applications/Dynare/x.y/matlab
For example, for Dynare 6.2 type:
>> addpath /Applications/Dynare/6.2/matlab
2. Configuring MATLAB using the menu entries on macOS
You will only have to do this once as MATLAB will remember the setting the next time you run it.
- On the MATLAB
Home
tab, in theEnvironment
section, click onSet Path
- Click
Add Folder...
. Warning: DO NOT selectAdd with Subfolders...
- Select the
matlab
subdirectory of your Dynare installation. For example, if you have installed Dynare 6.2 in the standard location, select:/Applications/Dynare/6.2/matlab
- Apply the setting by clicking
Save
button
Configuring Octave for Dynare on macOS
Type the following at the Octave command prompt:
>> addpath /usr/local/lib/dynare/matlab
If you don’t want to type this command every time you run Octave, you can put
it in a file called .octaverc
in your home directory. This file will usually
be called /Users/USERNAME/.octaverc
.
Running and editing a Dynare example on macOS
- Create a working directory that will hold your Dynare models. For example,
/Users/USERNAME/work
. - Assuming that you are using Dynare 6.2, copy the
example model file (either
/Applications/Dynare/6.2/examples/example1.mod
or/usr/local/lib/dynare/examples/example1.mod
) to your working directory. - At the MATLAB or Octave command prompt, type the following to change the working directory:
>> cd /Users/USERNAME/work
- Then type the following to run the example model file:
>> dynare example1
- You can edit the example by typing:
>> edit example1.mod