5

I'd like to do similar as to what I can with Python - pip freeze > installed.txt and pip install -r installed.txt.

Is this possible?

3
  • Welcome to TeX.SX! Interesting question.
    – egreg
    Feb 26 '18 at 18:13
  • Good question. An alternative solution is to use the portable version of MikTeX (or TeXLive) instead. Then once you get it working, make a zip archive of the whole thing. Unzip it wherever desired. Also great for making a backup installation, in case your current installation is somehow disturbed.
    – user139954
    Feb 27 '18 at 15:38
  • Funny that you'd make that comment. I do use MikTeX portable however (through a fault of my own) I had managed to corrupt it but I was still able to interface with MPM, hence why I was trying to save the package list. Your suggestion is definitely a good one in general!
    – Geesh_SO
    Feb 27 '18 at 15:55
4

In lieu of someone more in the know, I believe that I worked it out (although it turned out I didn't need it in the end).

I first used mpm to get a list of my installed packages (I used grep through Git Bash on my Windows machine).

mpm --list | grep ^i > installed.txt

However this contains more information than just names.

i 00003       1494 zerohyph

So I used Notepad++ to do a regex replace to find the stuff prior to the name and replace it with nothing.

^.*\d+ 

With a file which listed package names, I then ran the command to install the packages.

mpm --require=@installed.txt

Which seemed to work okay.

28 packages have been successfully installed.

I'm sure that this could be improved upon.

2
  • 1
    You could get rid of the Notepad++ step by using awk to grab the fourth column. This is included w/ Git Bash on Windows. mpm --list | grep ^i | awk '{print $4}' > mpmlist.txt. Apr 9 '20 at 7:42
  • Also, just in case, it might be worth running Git Bash as Administrator and using mpm --admin --list to start with. Apr 9 '20 at 7:58
1

I use a different method when I upgrade Miktex as described here. This can also be used to transfer an installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.