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

MATLAB (Intel installation) fails to connect on Apple Silicon system #110

Closed sohaildasgupta closed 3 weeks ago

sohaildasgupta commented 3 months ago

I installed the MATLAB extension for VSCode on macOS. However, I cannot run any MATLAB script. It opens a new terminal and blanks out.

I also observe that in the bottom panel it shows "MATLAB: Not Connected". If I click on it and try to "Connect to MATLAB", nothing happens. My MATLAB path is correct. I tried re-installing with no success. I am using MATLAB version R2023B.

dklilley commented 3 months ago

Thanks for reporting this!

In the Output panel in VS Code (selecting "MATLAB Language Server" from the dropdown), a log directory is printed. Please share the log files within this directory.

sohaildasgupta commented 3 months ago

matlabLog.txt

The output log shows missing file or directory :

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

When I navigate to this path, there is no maca64 directory, but maci64 directory with the path_per_install file.

sohaildasgupta commented 3 months ago

I should point out that I tried the extension with the R2024a pre-release. IT WORKS as is! Could it be just a version issue? I haven't tried with other version.

Snaptraks commented 3 months ago

I had this exact problem, and my MATLAB window would hang forever, and the log directory would be essentially empty, except for one file with the only two lines:

(08:53:49) matlabls: Log Directory: C:\Users\Username\AppData\Local\Temp\matlabls_7652 (10:06:57) matlabls: Launching MATLAB...

I fixed it by NOT using the New Desktop feature, now VS Code connects quickly to MATLAB and I do not have errors saying that "This feature is not available without MATLAB running." I will add that I am using Windows 10.

I hope this can narrow down the issue and provides a workaround for now

dklilley commented 3 months ago

@sohaildasgupta - a few clarifying questions -

This strikes me as an issue with the MATLAB installation.

Edit: This has also been reported by someone in MathWorks. For them, it appeared that they had an intel version of MATLAB installed on a Mac arm machine. I suspect this may be the same case for you.

peoe commented 3 months ago

Sorry to chime in on this conversation, but I would like to support @Snaptraks argument with a similar experience:

I installed 2024a (24.1.0.2537033) today using the Apple Silicon installer, enabled the new desktop after launch, and correctly updated my install path but Matlab would just not connect. After going back and disabling the new desktop the connection occurs pretty rapidly and I can run scripts using the "Run File" command no problem.

hamidingit commented 3 months ago

Thanks for your feedback and continuous usage of our extension! just to clarify, if you have connection issues and using our extension with the "New MATLAB Desktop", please refer to https://github.com/mathworks/MATLAB-extension-for-vscode/issues/24 for the latest status.

pdgradney commented 3 months ago

I am having a similar issue running matlab version 2023a on my mac, the difference is I am running the intel version of matlab. I have a program that can only communicate with matlab via the intel version, as a result I can not run the arm version of matlab. Is there a way to get the vs code extension to work on an M2 mac using the intel version of matlab?