Skip to main content
Sgagan
Staff
Staff
October 3, 2023

Technical Tip: Uninstall FortiClient using a script on macOS

  • October 3, 2023
  • 0 replies
  • 12617 views
Description This article describes a scenario to uninstall FortiClient completely from macOS using a script.
Scope FortiClient.
Solution

This script will uninstall FortiClient if it was installed via the standard macOS package installer (PKG) method.

 

  1. Open a text editor (e.g., TextEdit) and create a new document.
  2. Add the following script to the document:

 

Sgagan_0-1696266282891.png

 

Script:


#!/bin/sh
# Uninstall FortiClient.sh
| uninstall_forticlient.sh
# This script will completely uninstall FortiClient and all supporting components
pkill FortiClientAgent
launchctl unload /Library/LaunchDaemons/com.fortinet*
rm -Rfv /Applications/FortiClient.app
rm -Rfv /Applications/FortiClient Uninstaller.app
rm -Rfy /Library/Application Support/Fortinet
rm -Rfy /Library/Internet
Plug-Ins/FortiClient_SSLVPN_Plugin.bundle
rm -Rfy/Library/LaunchDaemons/com.fortinet.f forticlient.vpn.plist' rm -Rfy /Library/LaunchDaemons/com.fortinet.forticlient,
rm -Rfv
'/Library/LaunchDaemons/com.fortinet.fortic
plist'
.fssoagent launchdaemon.plist'
rm -Rfy /Library/LaunchDaemons/com.fortinet.forticlient.epctrl.plist' rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlie
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticl
localAccounts=$(dscl. list /Users UniqueID | awk '$2 > 500 print $1}')
for user in $localAccounts;
do
rm -Rfy /Users/"$user"/Library/Application Support/Fortinet/ done

 

 

  1. Save the document with a .sh extension, for example, 'uninstall_forticlient.sh'. Note that If it does not allow to save with .sh, try to save the .rtf extension first and later change to .sh by renaming it.
  2. Open Terminal on the Mac.
  3. Navigate to the folder where the script is saved, using the ‘cd’ command. For example, if it is saved on the Desktop, navigate there using:
Sgagan_1-1696266282894.png

 

  1. Make the script executable:

 

Sgagan_2-1696266282894.png

 

  1. Run the script with sudo privileges to uninstall FortiClient:

 

Sgagan_3-1696266282895.png

 

It will be possible to enter the admin password to execute the script with sudo.

 

This script will locate and remove FortiClient application files and related configuration files.

Use it with caution and ensure to have a backup of any important data or configurations associated with FortiClient before running the script.

Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
Thought Leadership. Security Summit. Thursday, October 8th. Disney's Grand Californian Hotel & SPA, Anaheim, CA.
Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT