SDRPlusPlus/macos/set_library_path.sh
2021-11-15 18:04:57 +01:00

18 lines
329 B
Bash

#!/bin/sh
set -e
# Options
WANTED_LIB=$1
NEW_PATH=$2
EXEC=$3
# Function to extract the first element of a space seperated list
get_first_arg() {
echo $1
}
# Get current path
CURRENT_PATH=$(get_first_arg $(otool -L $EXEC | grep $WANTED_LIB))
# Change to the new path
install_name_tool -change $CURRENT_PATH $NEW_PATH $EXEC