The whole directory chain has 755. I have the binary in Contents/Libs/bin/sox/sox (binary). The SoX binary is also code-signed.
It is indeed being spawned in a child process (node) within Electron. As I previously mentioned, this works fine if I use the Homebrew version.
const audioRecorder = spawn(soxPath, soxArgs)
As an alternative, might I have a script that installs this sox binary to /opt/bin/sox? I tried to make one with pkgbuild, codesign, & xcrun. It does make SoxInstaller.pkg, but fails when I try to run it and the logs are not written (I am just guessing at the script).
`#!/bin/bash
Set the log file path to a specific directory
LOGFILE="/tmp/sox_install.log"
Redirect output to the log file
exec > >(tee -a $LOGFILE) 2>&1
Start logging
echo "===> Starting SoX install script at $(date)"
echo "===> Log file: $LOGFILE"
Ensure the script is running with elevated privileges
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: This script must be run as root or with sudo"
exit 1
fi
Define the SoX binary path
SOX_BINARY="/tmp/sox"
#SOX_BINARY="$(dirname "$0")/sox"
echo "===> SoX binary expected at: $SOX_BINARY"
Check if the SoX binary exists
if [ ! -f "$SOX_BINARY" ]; then
echo "ERROR: SoX binary not found at $SOX_BINARY"
exit 1
else
echo "===> SoX binary found."
ls -l "$SOX_BINARY"
fi
Define the target installation directory
TARGET_DIR="/opt/sox"
echo "===> Target directory for SoX: $TARGET_DIR"
Create target directory if it doesn't exist
if [ ! -d "$TARGET_DIR" ]; then
echo "===> Target directory does not exist. Attempting to create it..."
sudo mkdir -p "$TARGET_DIR"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create target directory: $TARGET_DIR"
exit 1
else
echo "===> Successfully created $TARGET_DIR"
fi
else
echo "===> Target directory already exists: $TARGET_DIR"
fi
Copy the SoX binary to the target directory
echo "===> Copying SoX binary to $TARGET_DIR"
sudo cp "$SOX_BINARY" "$TARGET_DIR/sox"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to copy SoX binary to $TARGET_DIR"
exit 1
else
echo "===> SoX binary successfully copied to $TARGET_DIR"
ls -l "$TARGET_DIR/sox"
fi
Set executable permissions for the SoX binary
echo "===> Setting executable permissions for SoX"
sudo chmod 755 "$TARGET_DIR/sox"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to set permissions on $TARGET_DIR/sox"
exit 1
else
echo "===> Permissions successfully set for SoX binary"
fi
Verify SoX installation
echo "===> Verifying SoX installation"
if command -v "$TARGET_DIR/sox" &> /dev/null; then
echo "===> SoX installation verified. SoX binary located at $TARGET_DIR/sox"
else
echo "ERROR: SoX installation verification failed."
exit 1
fi
echo "===> SoX installation complete at $(date)"
exit 0`
Topic:
Code Signing
SubTopic:
General
Tags: