Skip to main content
Solved

Lansweeper Agent (LsAgent-osx.dmg)

  • February 8, 2023
  • 4 replies
  • 445 views

Forum|alt.badge.img+6

Hello,

Does anyone have a working method to install LsAgent-osx.dmg on computers with Jamf Pro and configure it with an agentkey? With no luck, I have tried making packages, scripts, and numerous other things, including Installomator. The only time the install works and the Mac communicates with our lsagentrelay is when I manually install the DMG, and even then, when I manually run LSAgent in the Application folder, I see an error that says "Configuration could not be updated: Access to the path '/Applications/LansweeperAgent/lsagentconfiguration.xml' is denied." Despite that error, it successfully communicates with Lansweeper. 

Any help would be appreciated, as I've tried everything I've found online so far. 

Thanks,

Steve

Best answer by mojo21221

Im sure this could be cleaned up a little, but it works for us as is.. I have scrubbed out our data and replaced with **** so all you have to do is replace those stars with the data from your LS server, port and agent key. Run the script on said machine no need to upload or deal with packages dmgs etc..

 

#!/bin/zsh # disk image fileURL="https://content.lansweeper.com/lsagent-mac/" # Specify name of downloaded disk image LsAgent_dmg="/tmp/LsAgent-osx.dmg" # Download the latest LSAgent software disk image /usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL" # Specify a /tmp/LsAgent mountpoint for the disk image TMPMOUNT=`/usr/bin/mktemp -d /tmp/LsAgent` # Mount the latest LsAgent disk image to /tmp/LsAgent mountpoint hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen # Install LsAgent from the installer package stored inside the disk image "/tmp/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ****** --port **** --agentkey ************ --prefix /usr/local/LsAgent --mode unattended sleep 30 # Clean-up # Unmount the LsAgent disk image from /tmp/LsAgent /usr/bin/hdiutil detach "$TMPMOUNT" # Remove the /tmp/LsAgent mountpoint /bin/rm -rf "$TMPMOUNT" # Remove the downloaded disk image /bin/rm -rf "$LsAgent_dmg" exit 0

 

4 replies

mojo21221
Forum|alt.badge.img+12
  • Valued Contributor
  • Answer
  • February 8, 2023

Im sure this could be cleaned up a little, but it works for us as is.. I have scrubbed out our data and replaced with **** so all you have to do is replace those stars with the data from your LS server, port and agent key. Run the script on said machine no need to upload or deal with packages dmgs etc..

 

#!/bin/zsh # disk image fileURL="https://content.lansweeper.com/lsagent-mac/" # Specify name of downloaded disk image LsAgent_dmg="/tmp/LsAgent-osx.dmg" # Download the latest LSAgent software disk image /usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL" # Specify a /tmp/LsAgent mountpoint for the disk image TMPMOUNT=`/usr/bin/mktemp -d /tmp/LsAgent` # Mount the latest LsAgent disk image to /tmp/LsAgent mountpoint hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen # Install LsAgent from the installer package stored inside the disk image "/tmp/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ****** --port **** --agentkey ************ --prefix /usr/local/LsAgent --mode unattended sleep 30 # Clean-up # Unmount the LsAgent disk image from /tmp/LsAgent /usr/bin/hdiutil detach "$TMPMOUNT" # Remove the /tmp/LsAgent mountpoint /bin/rm -rf "$TMPMOUNT" # Remove the downloaded disk image /bin/rm -rf "$LsAgent_dmg" exit 0

 


Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 8, 2023

Im sure this could be cleaned up a little, but it works for us as is.. I have scrubbed out our data and replaced with **** so all you have to do is replace those stars with the data from your LS server, port and agent key. Run the script on said machine no need to upload or deal with packages dmgs etc..

 

#!/bin/zsh # disk image fileURL="https://content.lansweeper.com/lsagent-mac/" # Specify name of downloaded disk image LsAgent_dmg="/tmp/LsAgent-osx.dmg" # Download the latest LSAgent software disk image /usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL" # Specify a /tmp/LsAgent mountpoint for the disk image TMPMOUNT=`/usr/bin/mktemp -d /tmp/LsAgent` # Mount the latest LsAgent disk image to /tmp/LsAgent mountpoint hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen # Install LsAgent from the installer package stored inside the disk image "/tmp/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ****** --port **** --agentkey ************ --prefix /usr/local/LsAgent --mode unattended sleep 30 # Clean-up # Unmount the LsAgent disk image from /tmp/LsAgent /usr/bin/hdiutil detach "$TMPMOUNT" # Remove the /tmp/LsAgent mountpoint /bin/rm -rf "$TMPMOUNT" # Remove the downloaded disk image /bin/rm -rf "$LsAgent_dmg" exit 0

 


This worked perfectly! The only modifications I made were removing --server and --port (just using a relay server for our Macs), and I added another "-" in front of agentkey. I'm guessing one of the dashes was accidentally deleted when you removed your port number. Thanks a bunch for taking the time to share this with me, @mojo21221. I really appreciate it!

Steve


mojo21221
Forum|alt.badge.img+12
  • Valued Contributor
  • February 8, 2023

This worked perfectly! The only modifications I made were removing --server and --port (just using a relay server for our Macs), and I added another "-" in front of agentkey. I'm guessing one of the dashes was accidentally deleted when you removed your port number. Thanks a bunch for taking the time to share this with me, @mojo21221. I really appreciate it!

Steve


For sure, happy to help! Now if LS would only update their tool to allow for the Login item to be locked down in Ventura... You were correct. One of the dashes was accidentally removed. I updated the original response to reflect the additional "-". 


CDartois_VW
  • New Contributor
  • August 24, 2026

Necroing an old post because it helped me get a script-based installer working for LsAgent. Here is my updated version:
 

#!/bin/zsh

# Lansweeper LsAgent deployment for macOS (Jamf)

# Rosetta 2 pre-check (Apple Silicon only)
if [ "$(/usr/bin/uname -m)" = "arm64" ]; then
if ! /usr/bin/pgrep -q oahd; then
echo "Installing Rosetta 2..."
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
else
echo "Rosetta 2 already installed."
fi
fi

# Download URL for the latest Mac disk image
fileURL="https://content.lansweeper.com/lsagent-mac/"

# Local path for the downloaded disk image
LsAgent_dmg="/tmp/LsAgent-osx.dmg"

# Download the latest LsAgent disk image
echo "Downloading LsAgent..."
/usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL"

# Create a unique mountpoint under /tmp
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/LsAgent.XXXXXX)

# Mount the disk image
echo "Mounting..."
/usr/bin/hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen

# Install LsAgent silently
echo "Installing..."
"$TMPMOUNT/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ***** --port ***** --agentkey ***** --prefix /usr/local/LsAgent --mode unattended

sleep 30

# Clean-up
/usr/bin/hdiutil detach "$TMPMOUNT"
/bin/rm -rf "$TMPMOUNT"
/bin/rm -f "$LsAgent_dmg"

echo "Done."
exit 0

Hope someone finds it helpful.