Skip to content

Instantly share code, notes, and snippets.

@dropafterfree
Created February 25, 2026 22:46
Show Gist options
  • Select an option

  • Save dropafterfree/d1a1b0661b6d54569ab37c055b50b46e to your computer and use it in GitHub Desktop.

Select an option

Save dropafterfree/d1a1b0661b6d54569ab37c055b50b46e to your computer and use it in GitHub Desktop.
LM Studio deb package fix
#!/usr/bin/env bash
# Extracts LM Studio deb package, fixes paths and rebuilds
# This is slow but results in a clean install package, for probably any version
export LMSDEB=$1
if [[ -z "$LMSDEB" || "$LMSDEB" != *.deb ]]; then
echo "Usage $0 LM-Studio-x.x.x-x-x64.deb"
exit 1
fi
fakeroot bash -c '
mkdir /tmp/tmp-patch-lmstudio-deb
dpkg-deb -R $LMSDEB /tmp/tmp-patch-lmstudio-deb/
mv /tmp/tmp-patch-lmstudio-deb/opt/LM\ Studio /tmp/tmp-patch-lmstudio-deb/opt/lmstudio
sed -i "s@opt/LM\ Studio@opt/lmstudio@g" \
/tmp/tmp-patch-lmstudio-deb/DEBIAN/md5sums \
/tmp/tmp-patch-lmstudio-deb/DEBIAN/postinst \
/tmp/tmp-patch-lmstudio-deb/usr/share/applications/lm-studio.desktop
dpkg-deb -b /tmp/tmp-patch-lmstudio-deb patched-${LMSDEB}
rm -rf /tmp/tmp-patch-lmstudio-deb
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment