[5.0] Portable Zotero

This discussion was created from comments split from: Zotero 5.0 Beta.
  • Hi, I have always got my students to use Zotero within a portable version of Firefox so they can use it in the campus computer labs (and I use it that way when giving demonstrations). With 5.0 dispensing with the Firefox version, what are the chances of making Zotero 5.0 portable? (I know there was a project to create a portable version of Zotero Standalone, but I gather it stalled.)
  • No need to use the bookmarklet. If they were using Portable Firefox, they could use the upcoming Zotero Connector for Firefox and have it save directly to zotero.org. That's still not a replacement for the Zotero software, but it's far preferable to the bookmarklet. We're hoping to get in some improvements to the bookmarklet soon, but it's still going to be severely limited in functionality and user experience by technical factors, so it's really only a last-resort option.

    But for real work, they really would want to use the connector with the Zotero client, since the website is still much more limited and less efficient. You also need the desktop version for word processor integration (though that depends whether the students can install the Word/LibreOffice plugin on a lab computer). I don't know off-hand what's involved in producing a portable version, but if people want to work on that I'm happy to offer guidance.
  • There is a PortableApps version of Zotero available here:


    You have to have PortableApps installed on the USB drive. You then use the PortableApps interface to "Install a new app" ("Get more apps" won't come up with Zotero on the menu). This installs version 4.0.19 on the USB. You can then update from the Zotero menu. Just did this and it updated to

    This gives you the full Zotero client, on the USB, with the library storage also on the USB. I run this on a 256 GB portable SSD. Works great.
  • I was able to get PortableZoteroStandalone 4 up and running, and when I checked for updates it downloaded and installed 5 quite happily - except for one snag. It throws up a "Data Directory Migration Error". Apparently Zotero5 wants to use your Windows user directory to store its data directory, instead of PortableZotero's profile directory. If you tell the error message to go away Z5 seems to work just fine, but it throws up the error message again every time you restart.

    Is there any way of telling Z5 you really want to use the profile directory in the PortableZotero directory? I could set a custom location for the data directory - but then I'd have an absolute address, and if the USB stick gets given a different drive letter next time I plug it in, Zotero won't be able to find its data directory.

    BTW, you don't actually need the PortableApps environment to run portable apps - you can just download the PAF file from the link above and when you double-click on it, it will install to any folder you tell it to. You can then run it manually from the folder where you put it by finding the Zotero exe file and double-clicking on it. Having the PortableApps environment installed on the USB drive adds a few nice features, like being able to manage your apps and use your own fonts, but it isn't required.
  • Is there any way of telling Z5 you really want to use the profile directory in the PortableZotero directory?
    Not currently — storing the data directory within the profile directory just isn't a supported configuration anymore, so Zotero considers that a legacy location and tries to migrate out of there.

    How do you specify the profile directory here? I assume this uses the -profile flag, dynamically setting the path based on the directory it's running from?

    It seems like we could support this with one of two ways — a flag to tell Zotero to use 'zotero' within the profile directory like it used to or a flag to specify a data directory explicitly, overriding any data directory specified in the prefs in the profile directory.
  • @claude70 : I'm in your exact same situation.

    @dstillman : for Z4, I used to have a folder with Zotero installed in it and the database in a subfolder. I was using a shortcut to launch Zotero with arguments [-profile "profile\Profiles\XXXX"]

    Would be wonderful if we could have a way to make this work with Zotero 5...
  • edited August 8, 2017

    Edit: nevermind.
  • edited August 9, 2017
    Ok, after my first attempt, using environment variables (which used to work on Z4), it looks like portabilizing Z5 could still be possible with some extra work. See below

    1) Extract Zotero using Universal Extractor
    2) In the Zotero.exe folder, create a new file, zotero-portable.cmd and paste the following to redirect several system folders to a subfolder named 'data' contained in the zotero.exe directory.

    @echo off
    set APPDATA=%~dp0data\AppData\Roaming
    set LOCALAPPDATA=%~dp0data\AppData\Local
    set HOMEDRIVE=%~d0
    set HOMEPATH=%~p0data
    set USERPROFILE=%~dp0data

    3) run zotero-portable.cmd. Some files will be created in the data folder (located in the same folder as zotero-portable.cmd). Also, some files will be created in the real %appdata%\Roaming, %appdata%\Local, and %homepath%\Zotero

    4) close Zotero and run zotero-portable.cmd again. This time, a proper profile will be created in the redirected AppData folders.

    For Zotero 4, this was enough. The problem in Zotero 5 that the database remains in the real %homepath% directory. There are now two options: use junctions, symlinks to redirect %homepath%\Zotero to a location of your choosing. This is seamless but requires admin permissions and is not very portable across OS's or edit the preferences to point to a location of our choosing. I'll go with the second option.

    5) copy %homepath%\Zotero to the 'data' subdirectory created in step 2.

    6) edit the file data\AppData\Roaming\Zotero\Zotero\Profiles\\prefs.js and change the 'extensions.zotero.dataDir' entry to ABSOLUTE path to the Zotero folder copied in step 5. (Note this can also be done from Zotero)

    Right now, step 6 is not very portable since it has to be manually done but changing this automatically is scriptable as part of zotero-portable.cmd
  • Hi,
    Just to be sure to understand. Database will be impossible to migrate out of profile folder? In my case, even if you find a way to link/copy/junction, if it required admin permission, it will be unusable. I have a limit of space to my profile, and my current database exceed that.
    I will follow carefully this post, hoping someone come with a great idea to solve this. Thanks
  • edited August 10, 2017
    @mel47 It is possible. Junction is one approach. The other approach is to manually modify the library path (this can be done within Zotero itself in the Advanced tab of Preferences by changing the Data Directory Location ). Changing the path is the approach I took. By modifying prefs.js using a script to automatically change the data directory before Zotero starts, I think it would be possible to fully portabilize Zotero 5 (in combination with folder redirection as I outlined above)
  • Ah super! I will be happy to test eventually, but not now (too close of grant's deadline).
  • OK, I've added a command-line flag to make this easier. You can pass -datadir profile to the Zotero executable to have it use a 'zotero' directory within the Zotero profile directory, the same as Zotero 4.0 did. (It also takes an absolute path.)

    This is available in the latest 5.0 Beta, and it'll be included in 5.0.18, which should be out in a day or two.
  • 5.0.18 is available now with this flag.
  • I've started using this in my tests and they pass.
  • edited October 11, 2017
    Hi, can someone help me out with this? I just installed the connector for Firefox and unwittingly lost access to Zotero in the browser. Universal extractor didn't work for Zotero 5.0. Instead, I installed Zotero to my PC and then copied the Zotero folder under C:\Program Files to my flash drive. I didn't know how to "pass -datadir profile", but after looking around online I created a Zotero shortcut and added "-datadir profile" at the end of the Target under the shortcut properties.

    I then open Zotero with that shortcut and under preferences it lists my Data Directory Location as "C:\Users\Home\AppData\Roaming\Zotero\Zotero\Profiles\d7222u6c.default\zotero"
    It also says "(specified via command line)" and I can't change the directory location.

    I also tried opening Zotero with the regular .exe and changed the Data Directory to the Zoter folder within my portableFirefox data. It reads all my old data in, but I'm wondering if this is going to work.

    How can I properly change the directory to a location on my Flash drive? Do I need to do all (or some) of the things @ferrio suggests? And is there a way to use relative paths to ensure that I can use Portable Zotero while different PC's recognize the flash drive as E:\, F:\, or I:\ etc.

    Thank you all.
  • I just created a Zotero 5 portable installer with portableapps model. I've tested it quickly, it seems to work.

    - Is it OK with the zotero's developers if I publish it on the internet? (PortableApps forums or GitHub)
    - Are people here interested in using it?
  • @pierremorlannefendan, you can bet people are interested!
    I can't speak for the developers, but AFAIK they never objected to previous portability efforts.
    I'm looking forward to this.
  • Ok. I'll post a link here tomorrow.
  • Also not speaking for Zotero, but the general attitude is to encourage these type of efforts, but ask developers to make clear that they're not officially endorsed (so there's e.g. no expectation that Zotero devs troubleshoot them). So if you mark the portable app as unofficial or something like that, that'd be appreciated.
  • Will do! Thanks :)
  • edited October 31, 2017

    Here's the installer:
    - edit - ref. GitHub below to download last version.

    It's not finished yet. You'll find some trace of the template I used if you look into the files and folders after installation. But it seems to me that it is working...
    I'm gonna create a thread on portableapps forums so you'll be able to tell me if there's things not working. I'll post a link here, just maybe not today :(
    I modified the splash screen when you launch the program to reflect @adamsmith 's comment: https://www.dropbox.com/s/zk96g07da4duhks/Splash.jpg

    I made a modification: pdftotext and pdfinfo are already installed.

    I'm ready to receive any comments, but I'm just a french librarian doing this on his free time, I may not be able to answer to everything :P
  • I just realized that, even if this works, Zotero still creates a Zotero folder in %AppData%

    I don't really understand why... Could someone explain? (poke @danstillman )
  • @pierremorlannefendan Quick words to tell you I try your app. I didn't extensively try it, but in my "really-non-admin-friendly" environment, I didn't have problem yet. It connect to firefox portable easily, and Office word also. My library sync fines. My profile is in Portable folder. However, it's true that I get a second profile in AppData/Roaming and Local. However those one seems to not contain the zotero.sqlite (which I could live with, because the problem with profile is mostly that we are space-limited)

    However, will try to use on regular basis to see how it goes.
  • @mel47 de rien !

    Thoses %Appdata% leftovers are pissing me off. I cannot figure out a way to make Zotero fully portable. I think it's related to the prefs.js file that Zotero re-locate everytime in %appdata%.

    I created a thread on portableapps as planned :

    But nobody is answering me on those forums.
  • edited October 31, 2017

    I've found a solution.
    You can download new version here:
    - edit - ref. GitHub below to download last version.

    Link to Portable apps topic:
  • Thank you very much for providing this updated portable zotero client!

    In the ZoteroPortable.ini file you added SupportsUNC=yes
    Is it really save starting a zotero portable client on a network share?
  • I don't think it could lead to problems. I launched this version from a network drive several times. But my network didn't crashed when Zotero was running. So, as I don't really know, I'll switch SupportsUNC to warn.

    Thanks for your feedback :)
  • Just now zotero standalone 5.0.28 was released. Updating the zotero protable client via Help -> Check for updates results in an error. The update is installed but zotero portable is not starting only this message appears: "Your Zotero profile cannot be loaded. It may be missing or inaccessible." After restarting zotero portable another time everything works again as expected. Could you look into this issue? Thank you!
Sign In or Register to comment.