How can I stop the MathWorks Service Host from running on startup?

조회 수: 222 (최근 30일)
Matthew Elmer
Matthew Elmer 2024년 8월 1일
댓글: Bennet 2025년 5월 13일
How can I stop the MathWorks Service Host from running on startup?

채택된 답변

Matthew Elmer
Matthew Elmer 2024년 8월 1일
편집: Matthew Elmer 2024년 8월 1일
This answer that was given by the same person who asked the question is a lie. It's easily disabled.
The first and best option for disabling the MathWorks Service Host is to uninstall Matlab and use a better programming language.
If you are in the unfortunate position of needing to be able to run Matlab code due to its recalcitrance in being purged from our research institutions, then you can at least prevent the process from running on startup. I do not know the precise steps to disable the startup process on Windows, but you can probably find and disable it if you poke around in the startup applications settings. On Fedora 40 linux, you can either remove the entry from startup applications via Gnome Tweaks, or you can open
/home/$USER/.config/autostart/mathworks-service-host.desktop
and comment out the part that comes after the equals sign on the line that starts with Exec=, i.e., change
Exec=/home/$USER/.MathWorks/ServiceHost/-mw_shared_installs/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost service --realm-id companion@prod@production
to
Exec=#/home/$USER/.MathWorks/ServiceHost/-mw_shared_installs/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost service --realm-id companion@prod@production.
The audacity of MathWorks to attempt to tell me what I can and cannot do on my own computer is amusing, but foolish.
  댓글 수: 2
Mike VanHorn
Mike VanHorn 2024년 8월 1일
@Matthew Elmer This is good information, but it is useful only when the user has already run the software once. Is there a way to "pre-comment this out" before the user has run the software? I figure I can pre-create the mathworks-service-host.desktop for newly created accounts, but I don't want to have to touch every account which already exists but hasn't run R2024a yet.
I did a search through the install directory, and I didn't find a "mathworks-service-host.desktop" file that could be modified, which I think means it's either compressed somewhere waiting to be deployed when the application starts or it just creates it from scratch.
I guess what I'll do for now is put the modified "mathworks-service-host.desktop" into the skel files for new accounts, and create a script to run through all the existing home directories.
Thanks!
Mike VanHorn
Mike VanHorn 2024년 8월 1일
편집: Mike VanHorn 2024년 8월 1일
@Matthew Elmer Further testing shows that while commenting out the line in the "mathworks-service-host.desktop" does keep the service from starting at login, the client still gets started when Matlab runs. So, my method of symlinking $HOME/.MathWorks/ServiceHost to a place in the local /tmp directory is still necessary to work around the incredible slowness associated with the creation of that directory the first time a user runs MATLAB (as the client runs from $HOME/.MathWorks/ServiceHost). For those who aren't paying attention, the Service Host installer puts 1.4GB of files into $HOME/.MathWorks/ServiceHost.
So, anyway, still looking for a way to disable the ServiceHost. But, on the bright side, it seems that the ServiceHost processes do get killed when the user logs out, so at least they aren't running rampant.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Mike VanHorn
Mike VanHorn 2024년 8월 1일
편집: Mike VanHorn 2024년 8월 1일
Also, I can confirm this answer is at least partially false.
I tried removing $HOME/.MathWorks/ServiceHost/wilbur26/v2024.7.0.6/bin/glnxa64/MathWorksServiceHost, and while MATLAB start up was then slow, it did start up, and the licensing was fine. So MathWorksServiceHost seems to be NOT "essential for MATLAB licensing and MATLAB startup". I'm thinking it must only be related the MATLAB Connector.
However, there does, indeed, seem to be no way to disable it, and rather only work around it's slowness.

Dimitrios
Dimitrios 2024년 9월 2일
Hi Matthew,
In order to disable MathWorks Service Host from starting at Operating System login, you can:
Windows: Follow these instructions of Microsoft to toggle off the Mathworks Service Host startup
Linux: Delete this file: ~/.config/autostart/mathworks-service-host.desktop
macOS: Delete this file: ~/Library/LaunchAgents/com.mathworks.mathworksservicehost.agent.plist
If these files are deleted, MathWorks Service Host will honour this choice and will not re-create them. However modifying the files, as suggested in other answers, will not work for very long, as they will be updated when MathWorks Service Host is updated.
Please note that MathWorks Service Host will still run when MATLAB is started, and that MathWorks Service Host is required for the correct functioning of MATLAB R2024a and later.
  댓글 수: 8
Conor Burgess
Conor Burgess 2025년 5월 13일
Thank you for your feedback. We have various options for customers for whom the default MathWorks Service Host workflow is not appropriate, and support can help us to understand your requirements and which of those options is most appropriate. Alternatively, if we need to work on a different option to support your requirements, we can capture that too. If you don't contact support, none of that is possible, but that is of course your choice!
Bennet
Bennet 2025년 5월 13일
Thanks for the additional information, Conor. We'll open a support ticket.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by