mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
215 stars 13 forks source link

Cannot connect to MATLAB 2024a on mac Sonoma 14.4.1 #127

Closed afugls closed 3 months ago

afugls commented 3 months ago

Describe the bug MATLAB was unable to start. MATLAB is installed and the MATLAB executable path setting is properly configured.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'vs code', open the workspace folder
  2. Click on 'Connect to MATLAB'
  3. Notification prompts: MATLAB was unable to start. If MATLAB is installed, confirm that the MATLAB executable path setting is properly configured
  4. See error

Expected behavior VS Code should connect to MATLAB.

Screenshots Pop up message:

Skærmbillede 2024-04-04 kl  11 27 17

Useful Information

Additional context MATLAB root: /Applications/MATLAB_R2024a.app

MATLAB extension settings:

Skærmbillede 2024-04-04 kl  11 28 18

Output log

(11:11:15) matlabls: Launching MATLAB...
[Error - 11.11.15] (11:11:15) matlabls - ERROR: Error launching MATLAB: spawn /Applications/MATLAB_2024a.app/bin/matlab ENOENT
[Error - 11.11.15] (11:11:15) matlabls - ERROR: Error launching MATLAB: Error
[Error - 11.11.15] (11:11:15) matlabls - ERROR: Error launching MATLAB: Error: spawn /Applications/MATLAB_2024a.app/bin/matlab ENOENT
    at Process.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
(11:11:15) matlabls: MATLAB process terminated
dklilley commented 3 months ago

Hi @afugls , thanks for reporting this!

I believe this may be a missing R in the installPath setting. Can you try changing this to /Applications/MATLAB_R2024a.app and see if this resolves the issue?

If not, please share the logs from the extension. The log directory should be displayed at the beginning of the Output log in VS Code. These logs may help to narrow down the issue.

afugls commented 3 months ago

Hi @dklilley, Thanks for looking at this.

I have updated the installPath with the missing R such that it now reads: /Applications/MATLAB_R2024a.app.

This has changed the behavior. However, it still does not work. The requested logs are as follows.

For languageServerLog.txt:

(15:54:27) matlabls: Log Directory: /var/folders/ct/qml4kr0s4218355cnp2jf9k80000gn/T/matlabls_8802
(15:54:27) matlabls: Launching MATLAB...
(15:54:27) matlabls: MATLAB process terminated

For matlabLog.txt:

env: /Applications/MATLAB_R2024a.app/bin/maca64/path_per_install: No such file or directory
mkdir: /bin/maca64: Operation not permitted

For reference, if I do an ls -l /Applications/MATLAB_R2024a.app/bin/, the output is

total 360
-r-xr-xr-x@    1 ajf  admin   6923 25 Jul  2023 ClassPathGenerator
-r-xr-xr-x@    1 ajf  admin   9664 20 Nov 00:23 controllingProduct.json
-r--r--r--@    1 ajf  admin   8560 20 Nov 02:30 crash_analyzer.cfg
drwxr-xr-x@    7 ajf  admin    224  3 Apr 13:01 icutzdata
-r--r--r--@    1 ajf  admin    906 20 Okt  2016 lcdata.xml
-r-xr-xr-x@    1 ajf  admin   2404 20 Okt  2016 lcdata.xsd
-r--r--r--@    1 ajf  admin  13176 30 Sep  2016 lcdata_utf8.xml
-r-xr-xr-x@    1 ajf  admin  13252 20 Nov 00:37 ldd
drwxr-xr-x     8 ajf  admin    256  3 Apr 14:22 m3iregistry
drwxr-xr-x@ 2241 ajf  admin  71712  3 Apr 14:30 maci64
-r-xr-xr-x@    1 ajf  admin  60672 20 Nov 00:37 matlab
-r-xr-xr-x@    1 ajf  admin   5267 13 Jun  2023 matlab-glselector.sh
-r-xr-xr-x@    1 ajf  admin   5209 13 Jun  2023 matlab_jenv
-r-xr-xr-x@    1 ajf  admin  10541 20 Nov 00:40 mex
-r-xr-xr-x@    1 ajf  admin  11549 20 Nov 00:40 mexext
-r--r--r--@    1 ajf  admin   7827 16 Feb 10:05 uninstaller_comp_deps.txt
drwxr-xr-x@    5 ajf  admin    160  3 Apr 13:02 util
dklilley commented 3 months ago

Thanks for sharing the logs!

It appears that you are encountering the same issue as in #110, which stems from having an Intel installation (maci) of MATLAB on an Apple Silicon machine (maca).

Unfortunately, the only known workaround is to install the maca version of MATLAB.

This is an issue we plan to look into for a future release of the extension. In the meantime, I am going to close this issue as a duplicate of #110 to avoid maintaining multiple issues. Please feel free to add any additional comments to that issue!

afugls commented 3 months ago

Thank you! Installing the MATLAB Apple Silicon solved the issue. I never realized I had installed the Intel version before.