12

I just installed TeXstudio 2.5.2 and compiled the following

\documentclass{article}
\begin{document}
\end{document}

but I get this error

Error: Could not start the command: "/usr/texbin/pdflatex" -synctex=1 -interaction=nonstopmode "texstudio_qH5268".tex

I already installed MiKTeX, so why do I get this error?

4
  • I'm having this error with TeXLive also. It happens when the editor does not find the bin files. You can do this: go to Options>Configure and insert the whole path for the pdflatex. If you use windows, look for C:\PROGRA~2\MIKTEX~2.9\miktex\bin\pdflatex.exe or something similar.
    – Sigur
    Jan 23, 2013 at 18:38
  • Also the discussion here sourceforge.net/p/texstudio/discussion/907839/thread/6363740c
    – Sigur
    Jan 23, 2013 at 18:40
  • Hi Sigur, in Options>Configure>Build>Default Compiler I have inserted the path C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe but still doesn't work.
    – user24846
    Jan 23, 2013 at 18:55
  • 1
    Try to use double quotes and the extension, but not on default compiler, try it on the other field (commands>pdflatex) "C:\....exe" %.tex
    – Sigur
    Jan 23, 2013 at 18:58

9 Answers 9

7

Open TeXstudio and go to the Options menu.

enter image description here

Then Configure TeXstudio. On the left panel choose the second item Commands.

enter image description here

On the pdflatex field, fill it with the full path for your pdflatex.exe. For example, in Windows with MiKTeX, something similar to

C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe 

Don't forget to use double quotes with it. Then write %.tex to denote the current tex file.

In summary, you'll have something like this (ignoring highlights):

"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" %.tex

You can do the same to other tools, like dvips for example.

2
  • 2
    Instead of adding the path multiple times, you can also set it under: Configure TeXstudio (Show Advanced Options) -> Build -> below Build Options -> Commands ($PATH). Insert the path, that contains the commands latex, pdflatex etc.
    – dexteritas
    Nov 12, 2021 at 10:26
  • I can only warn against this proposed solution. @dexteritas has the right solution. I've added another answer explaining why adding the path to all the tools in the configuration likely will cause other issues.
    – Max N
    Feb 14, 2022 at 9:37
6

I had the same problem with the start command. I have a Mac. I went to Preferences in the Texstudio menu, then Command, and after PdfLaTex just clicked on the yellow arrow for "Restore Default." It now works.

3

Seems like TeXstudio suffers from some bugs after changing the editor language! In my case, I changed from German to English, which had the effect that the Meta Commands were set to some wrong values internally, as it appears. For all the entries under Options -> Configure TeXstudio -> Build, i.e. the following:

  • Build & View
  • Default Compiler
  • Default Viewer
  • PDF Viewer
  • Default Bibliography Tool

I had to open the combobox and select the first entry. After that, a previously set German description changed to an English description and the commands worked again.

I'm using TeXstudio on Windows 10. The operating system is set to English, but a German-speaking country is configured in Region settings, which must have led the TeXstudio installer to default to German.

2

I'm using windows 10 and have tried all the solutions but it didn't work. Then I decided to reinstall my operating system. But I thought it could be related to the read/only feature on Windows then, I decided to install TeX Live on another drive instead of C: and add the commands' addresses. Finally, the problem was solved.

I hope this answer can help others.

1
  • Even defining the correct path to the Compilers using the "C:\texlive\...\pdflatex.exe" %.tex with the quotes " and percentage sign % as Sigur said in the comments helped? Sep 28, 2016 at 7:25
2

for me it helped to simply restore the default settings in TeXstudio via "Options>Restore Default Settings".

When choosing this option, TeXstudio then informs you that you have to manually restart TeXstudio after its settings have been restored to their default values and if you click okay, the program is closed. I opened TeXstudio again after this and chose "Build & View (F5)" and everything worked fine again.

Hope this helps.

2

First, troubleshoot:

latex in the terminal should give you something like:

This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021) (preloaded format=latex)
 restricted \write18 enabled.

which latex should tell you where the binary is loaded from, here this is

/usr/local/texlive/2021/bin/x86_64-linux/latex

If this works, try launching TeXstudio from the terminal (by entering texstudio) and see if it finds the latex binaries then. If any of the above does not work, you need to revisit the LaTeX installation and make sure to add the installation path to the $PATH variable.

If TeXstudio can find the binaries when launched from the terminal, but not through the desktop environment, you must add the path to TeXstudio with Menu Bar → Options → Configure TeXstudio. Here check the 'Show advanced Options' in the left bottom corner, select "build" and look at the very bottom for "Additional Search Paths" → "Commands ($PATH)". Add the path for your TeX installation, in my case /usr/local/texlive/2021/bin/x86_64-linux/

Do not prefix the path to all the individual commands in the "Commands" section of the preferences (as seen in some of the screenshots from the other answers). There are 467 files/tools in this directory. You will later get errors when you need to call one of the other tools, which not included in the dozen found in the "Commands" preferences. Example: the tufte class is calling kpsewhich and if you set up TeXstudio by prefixing the path to the standard commands instead of adding the path to the "Additional Search Paths" you will get latex sh: 1: kpsewhich: not found.

1

I was facing similar problem while migrating to TexStudio for editing the latex files (I previously used WinEdt). The problem got solved when I realized that I have installed MikTex in two separate locations of my workstation. The environment path variables were set correctly too. Solution: I uninstalled all previous version of Miktex and TexStudio; and installled a single version of both in my workstation. It works fine now. The configuration settings in TexStudio is as follows:

enter image description here

1

I got this kind of error message when moving a TEX file from Windows to Linux. After I remembered Linux is case sensitive, the solution was just to change from «.TEX» to «.tex» in the type extension of the file name. For example, pdflatex "command" searches file named « %.tex ».

1
  • 1
    Is it really the same error message? I would expect it say instead that the file could not be found, but I do not have a windows machine to test this on. Apr 23, 2018 at 8:11
0

On Fedora, it helped just to Configure TeXstudio... -> Build and click on all options in Meta commands - just select the already selected options.

1
  • 2
    Welcome to TeX.SE! It would help if you add a screenshot to your answer ...
    – Mensch
    Mar 29, 2018 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .