diff --git a/cbattery b/cbattery
index 9d41308..75fe662 100755
--- a/cbattery
+++ b/cbattery
@@ -78,7 +78,7 @@ install_visudo_file() {
 
 install_launch_daemon() {
     launch_daemon=/Library/LaunchDaemons/cbattery.plist
-    script_dir="$(dirname "$(realpath "$0")")"
+    script_dir="$(dirname "$(readlink -f "$0")")"
     share_plist="$SHARE_DIR/cbattery.plist"
     if ! grep -q "$script_dir" "$share_plist"; then
 	sed "s:/usr/local/bin:$script_dir:g" "$share_plist" | sudo tee "$share_plist" > /dev/null