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
234 stars 15 forks source link

cannot connect to MATLAB on mac os sonoma 14.2 #93

Closed yuchensun97 closed 7 months ago

yuchensun97 commented 7 months ago

Describe the bug MATLAB was unable to start. If MATLAB is installed, confirm that 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

Expected behavior VS Code should connect to MATLAB.

Screenshot

image

Useful Information

Additional context matlabroot: Applications/MATLAB_R2023b.app

image

output log:

(12:12:10) matlabls: Launching MATLAB...
[Error - 12:12:10 PM] (12:12:10) matlabls - ERROR: Error launching MATLAB: spawn Applications/MATLAB_R2023b.app/bin/matlab ENOENT
[Error - 12:12:10 PM] (12:12:10) matlabls - ERROR: Error launching MATLAB: Error
[Error - 12:12:10 PM] (12:12:10) matlabls - ERROR: Error launching MATLAB: Error: spawn Applications/MATLAB_R2023b.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)
(12:12:10) matlabls: MATLAB process terminated
dklilley commented 7 months ago

Thank you for reaching out with this issue!

I believe you are missing a leading / in your "Install Path" setting. I think the value returned by matlabroot in MATLAB should be /Applications/MATLAB_R2023b.app.

Does making this change enable MATLAB to launch?

dklilley commented 7 months ago

Hi @yuchensun97, I wanted to check back and see if the above suggestion resolved the issue you were running into?

yuchensun97 commented 7 months ago

/Applications/MATLAB_R2023b.app

Hi. Thank you. It works now.

yuchensun97 commented 7 months ago

Hi @yuchensun97, I wanted to check back and see if the above suggestion resolved the issue you were running into?

Hi @dklilley , now the VS Code can connect to MATLAB, but the MATLAB itself failed to launch.

dklilley commented 7 months ago

Can you provide a bit more info? Are you seeing any errors in VS Code? Does the status bar item go back to saying "MATLAB: Not Connected" or does it get stuck at "MATLAB: Establishing Connection"?

yuchensun97 commented 7 months ago

Can you provide a bit more info? Are you seeing any errors in VS Code? Does the status bar item go back to saying "MATLAB: Not Connected" or does it get stuck at "MATLAB: Establishing Connection"?

Hi. It's MATLAB: CONNECTED, but at the same time, the application MATLAB itself failed to launch.

versionbayjc commented 7 months ago

Remaining issue seems the same as https://github.com/mathworks/MATLAB-extension-for-vscode/issues/9?

dklilley commented 7 months ago

I believe @versionbayjc is correct. If VS Code is stating MATLAB: Connected, then MATLAB should have launched through the extension. This instance of MATLAB is not visible.

On Mac, there is currently a known issue (#9) which prevents launching a separate instance of MATLAB (i.e. via the dock) when MATLAB is connected in VS Code.

dklilley commented 7 months ago

Closing as a duplicate of #9, based on the previous comment.