For security reasons, I use two different user accounts on my computer. Thus my pnpm store is more or less duplicated on two accounts, given that I work on the same projects on both accounts.
Can I create a “shared store” for pnpm? And are there common practices/guides how to set that up?
I can see on my Mac the store is located in $HOME/Library/pnpm/store
(by default when following the normal instruction guide)
Both my users are members of the staff
group, which does not have write access to the folder (default MacOS behaviour), BUT only the owner has any access to $HOME/Libraray
.
I assume that I could move the pnpm
folder to $HOME/pnpm
on my main account, and give staff
write permissions? And adapt the config in my .zshrc
for my secondary account.
But is there a catch? Or is such a setup generally inadvisable?
Does the use of hard-links introduce any problems in that approach? (I’m not familiar with how hard-links work). If a shared store is feasible, is it better to uninstall/reinstall completely? Or create a new shared user account for this purpose alone?
notes
It’s not a big issue, after all it’s only 2 duplicates of my packages, compared to legacy npm behaviour (I just cleaned up about 60Gb of disk space by removing all node_modules
in my src/
folder)
I find this somewhat relatable to Homebrew which is only designed for single-user scenarios, but I have a setup that is similar to what I describe. Most packages installed from the primary account are available to all users. My solution is when I brew
from my secondary account, it automatically su
s to the primary account and run the command. Fonts is an example that doesn’t work, as they gets installed to $HOME/Libraray/Fonts
, in which case those require a bit of post-installation cp
-work.
The security reason is to avoid exposing sensitive information when screen sharing/streaming. Both by my own mistake, or by receiving a message that shows a notification on shared. Could be sensitive, could be personal, could be inappropriate 😉 So only resources necessary for coding are available in the secondary account.