As I've pointed out here, on Linux it might be problematic to simply Block
the $userRepositoryDir
as you will need root-access for that in the default installation. No matter how you do this, you need to ensure that you can write there if you want to make it consistently working for all operating systems.
To the best of my knowledge, there is currently no easy way to install a paclet for all users automatically. What you want is to install a paclet in the PacletManager`Package`$sharedRepositoryDir
but this option is not exported. When you call PacletInstall
it will call PacletManager`Manager`Private`installPacletFromFileOrURL
and there, the installation destination is hard-coded to $userRepositoryDir
.
This is why Block
ing this kind of works. I say "kind of" because after the paclet is unzipped into the destination, Mathematica rebuilds the internal information about installed paclets by calling PacletManager`Package`PCrebuild
. If your destination is anything other than $userRepositoryDir
or $sharedRepositoryDir
, this shouldn't work, because the paclets to rebuild are again hard-coded as "Collections" -> {"User"}
. Please look at the end of the definition of installPacletFromFileOrURL
.
Therefore, the only sensible solution I see at the moment is
- Check if you have write access to
PacletManager`Package`$sharedRepositoryDir
. If not, and you are on Linux, you might want to ask the user to re-run Mathematica with sudo
.
Block
the $userRepositoryDir
as suggest by b3m2a1 and already used by Kuba.
$userRepositoryDir
and a$sharedRepositoryDir
. $\endgroup$Block
the$userRepositoryDir
with$BasePacletsDirectory/Repository
. Worked for me. AlthoughPacletFind
freaks out a little bit and returns the paclet twice. $\endgroup$WithPacletsRepository
: github.com/kubaPod/MPM/blob/master/MPM/MPM.m $\endgroup$Get
orPacletInformation
respect the most specific repository at the end. Otoh I won't bet my hand on that :) $\endgroup$