diff --git a/README.md b/README.md
index 5b4cea7..05fb0a6 100644
--- a/README.md
+++ b/README.md
@@ -53,8 +53,8 @@ Logs are stored in `C:\windows\logs\bridge.log`.
## macOS
-The steps to install are almost the same. The only difference is that if you want the service to work, you will have to use [this script](macos.sh) to install a launch agent that will symlink the `$TMPDIR` to a static path (`/tmp/rpc-bridge/tmpdir`).
-To do so, download it, make it executable (`chmod +x macos.sh`) and run `./macos.sh install`. You can uninstall the agent by running `./macos.sh uninstall`.
+The steps to install are almost the same. The only difference is that if you want the service to work, you will have to use [this script](build/launchd.sh) to install a launch agent that will symlink the `$TMPDIR` to a static path (`/tmp/rpc-bridge/tmpdir`).
+To do so, download it, make it executable (`chmod +x launchd.sh`) and run `./launchd.sh install`. You can uninstall the agent by running `./launchd.sh uninstall`.
## Compiling from source
diff --git a/build/launchd.sh b/build/launchd.sh
new file mode 100755
index 0000000..eeabea0
--- /dev/null
+++ b/build/launchd.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# This script is used to create a LaunchAgent on MacOS, to support the service functionnality.
+# Usage: ./launchd.sh (install|remove)
+
+SYMLINK=/tmp/rpc-bridge/tmpdir
+LOCATION=~/Library/Application\ Support/rpc-bridge
+SCRIPT=$LOCATION/rpc-bridge
+AGENT=~/Library/LaunchAgents/com.enderice2.rpc-bridge.plist
+
+function install() {
+ # Directories
+ if [ ! -d "$SYMLINK" ]; then
+ mkdir -p "$SYMLINK"
+ fi
+ if [ ! -d "$LOCATION" ]; then
+ mkdir -p "$LOCATION"
+ fi
+
+ # Link script
+ if [ -f "$SCRIPT" ]; then
+ rm -f "$SCRIPT"
+ fi
+ echo "#!/bin/bash
+TARGET_DIR=/tmp/rpc-bridge/tmpdir
+if [ ! -d "\$TARGET_DIR" ]; then
+ mkdir -p "\$TARGET_DIR"
+fi
+rm -rf "\$TARGET_DIR"
+ ln -s "\$TMPDIR" "\$TARGET_DIR"" > "$SCRIPT"
+ chmod +x "$SCRIPT"
+
+ # LaunchAgent
+ if [ -f "$AGENT" ]; then
+ rm -f "$AGENT"
+ fi
+ echo "
+
+
+
+ Label
+ com.enderice2.rpc-bridge
+ ProgramArguments
+
+ $SCRIPT
+
+ RunAtLoad
+
+
+" > "$AGENT"
+ launchctl load "$AGENT"
+ echo "LaunchAgent has been installed."
+
+}
+
+function remove() {
+ rm -rf "$SYMLINK"
+ rm -rf "$LOCATION"
+ rm -f "$SCRIPT"
+ if [ -f "$AGENT" ]; then
+ launchctl unload "$AGENT"
+ fi
+ rm -f "$AGENT"
+ echo "LaunchAgent has been removed."
+}
+
+# CLI
+if [ $# -eq 0 ]; then
+ echo "Usage: $0 (install|remove)"
+ exit 1
+fi
+
+case $1 in
+ install)
+ install
+ ;;
+ remove)
+ remove
+ ;;
+ *)
+ echo "Invalid argument. Please use 'install' or 'remove'."
+ exit 1
+ ;;
+esac
\ No newline at end of file
diff --git a/macos.sh b/macos.sh
deleted file mode 100644
index 5748c9a..0000000
--- a/macos.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-
-# Define target directory
-TARGET_DIR=/tmp/rpc-bridge/tmpdir
-P_DIR=$(dirname "$TARGET_DIR")
-FILE_PATH=$P_DIR/link
-
-# Function to create the symlink and launch agent
-function install_link() {
-
- if [ ! -d "$P_DIR" ]; then
- mkdir -p "$P_DIR"
- fi
-
- cat << EOF > "$FILE_PATH"
-#!/bin/bash
-TARGET_DIR=/tmp/rpc-bridge/tmpdir
-if [ ! -d "\$TARGET_DIR" ]; then
- mkdir -p "\$TARGET_DIR"
-fi
-rm -rf "\$TARGET_DIR"
-ln -s "\$TMPDIR" "\$TARGET_DIR"
-EOF
-
- chmod +x "$FILE_PATH"
-
- # Launch agent plist file path
- PLIST_FILE=~/Library/LaunchAgents/com.rpc-bridge.tmp-symlink.plist
-
- # Create the launch agent plist with escaped variable
- cat << EOF > "$PLIST_FILE"
-
-
-
-
- Label
- com.rpc-bridge.tmp-symlink
- ProgramArguments
-
- $FILE_PATH
-
- RunAtLoad
-
-
-
-EOF
-
- # Load the launch agent
- launchctl load "$PLIST_FILE"
- echo "Symlink created and launch agent installed."
-}
-
-# Function to remove the symlink and launch agent (unchanged)
-function remove_link() {
- # Remove the symlink
- rm -rf "$TARGET_DIR"
-
- # Launch agent plist file path
- PLIST_FILE=~/Library/LaunchAgents/com.rpc-bridge.tmp-symlink.plist
-
- # Unload the launch agent
- launchctl unload "$PLIST_FILE"
-
- # Remove the files
- rm -f "$PLIST_FILE"
- rm -f "$FILE_PATH"
- echo "Symlink removed and launch agent uninstalled."
-}
-
-# Check for user input
-if [ $# -eq 0 ]; then
- echo "Usage: $0 (install|remove)"
- exit 1
-fi
-
-# Action based on user input
-case $1 in
- install)
- install_link
- ;;
- remove)
- remove_link
- ;;
- *)
- echo "Invalid argument. Please use 'install' or 'remove'."
- exit 1
- ;;
-esac
\ No newline at end of file