I have a problem running my code which is written in Dynare and runs in MATLAB. It is a log-linearized model with Bayesian estimation of parameters. The code runs perfectly in earlier versions of MATLAB on both PC and Mac but cannot run after computing steady state in my current version of MATLAB: 2017 prerelease (updated in December 2016).
The error reports:
Invalid MEX-file ‘/Applications/Dynare/4.4.3/matlab/…/mex/matlab/osx64/mjdgges.mexmaci64’:
dlopen(/Applications/Dynare/4.4.3/matlab/…/mex/matlab/osx64/mjdgges.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib
Referenced from: /Applications/Dynare/4.4.3/mex/matlab/osx64/mjdgges.mexmaci64
Reason: image not found.

Does anyone encounter the same problem and does anyone know how to solve this?

I tried copying the ‘mex’ file under Dynare/4.4.3/matlab but it didn’t work, still reporting the same error. I also tried changing the path in the ‘Dynare_config.m’ to make MATLAB follow the path of ‘Dynare/4.4.3/mex’ but still reporting the same error.

My first guess is that, with this version, Matlab renamed or removed a shared library that they used to distribute. In any case, I’d recommend you stick with an earlier version of Matlab as Dynare 4.4.3 was released a few years ago it’s not guaranteed to be compatible with versions of Matlab or Octave that have been released since then.

If this problem persists in the official Matlab release, I’ll consider making new mex files and distributing them. I’ll make a post here if I do.

I’m posting this follow-up replay to let you know that, regarding the problem with invalid MEX-File in MATLAB with Dynare 4.4.3, I updated my MATLAB to the official release R2017a, but the problem remains. It happens after the computation of initial values (steady states). Error reports as below:

Invalid MEX-file
’/Applications/Dynare/4.4.3/matlab/…/mex/matlab/osx64/mjdgges.mexmaci64’:
dlopen(/Applications/Dynare/4.4.3/matlab/…/mex/matlab/osx64/mjdgges.mexmaci64, 6):
Library not loaded: @loader_path/libmex.dylib
Referenced from: /Applications/Dynare/4.4.3/mex/matlab/osx64/mjdgges.mexmaci64
Reason: image not found.

Do you have any suggestions for this problem, besides turning the clock back to pre-2017 matlab time?

Yes I was getting the same error message, right after the steady state values are displayed. The problem occurs when dynare calls ‘dyn_first_order_solver’

I encounter the same problem running Dynare 4.4.3 on Matlab R2017a (official release), running on macOS Sierra. The problem remains when using the unstable Dynare release. I would greatly appreciate a solution (other than downgrading Matlab).

The other solution is to build dynare via homebrew. See this page dynare.org/DynareWiki/InstallOnMacOSX. Follow the directions for Dynare Unstable (which will be the next version of Dynare), replacing R2014b with R2017a and 8.4 with 9.2. If you want to build Dynare 4.4 (current stable), remove --HEAD from the command.

I am not sure I will have the time to make a new dynare release for 4.4. FYI, we hope to have Dynare 4.5 out in the next month or so.

Hi everyone
I encounter the same problem running Dynare 4.4.3 on Matlab R2017a (official), running on macOS Sierra. I try as you said to build dynare via homebrew but got an message error in the final step
==> Installing dynare from homebrew/science
Error: You must brew link ghostscript before homebrew/science/dynare can be installed
I’ve tried all the recommended solution but it still don’t work
Have any other solution
Fabrice

==> Installing dynare from homebrew/science
Error: You must brew link ghostscript before homebrew/science/dynare can be installed
10-232-80-132:~ fabriceanicetparfaitdabire$

dynare running now after your brew install suggestion
but need to set the path as precise in terminal before running your code
"addpath /usr/local/opt/dynare/lib/dynare/matlab"

I used to set the path like this before
"addpath /Applications/Dynare/4.4.3/matlab"

Maybe you can just try set it like : addpath /usr/local/opt/dynare/lib/dynare/matlab to see if it work without no need to brew install first
I hope this will fix by an update
thank you

Thanks a lot!! The Homebrew installation works fine.

The only minor issue I have right now is that the documentation is not built (even though I used the --with-tex option). Of course, I can easily copy the pdfs from a different computer.

I didn’t get any error message, it just didn’t create the PDFs with documentation…

First, I have MacTex installed (without Homebrew).

Second, the following packages seem to be required to build the documentation:

GNU Texinfo

Texi2HTML and Latex2HTML, if you want nice mathematical formulas in HTML output

Doxygen (if you want to build Dynare preprocessor source documentation)
These are installed via Homebrew and are, as a matter of fact, in the /usr/local/Cellar folder of my computer.

Attached I include one of the log files of the Homebrew Dynare installation (found via the Mac OS Console). It seems to indicate some problems although I am not sure what precisely happens (and how to solve it). Maybe it has something to do with the hyperref package but I am not sure.

Any help would be appreciated! Of course, it’s not really important since it’s easy to find the documentation on the webpage, but other users might face the same issue.