Skip to content

Instantly share code, notes, and snippets.

@dineshshetty
Created October 24, 2017 20:37
Show Gist options
  • Save dineshshetty/8c4967fa5ed9532c36528806bdaec209 to your computer and use it in GitHub Desktop.
Save dineshshetty/8c4967fa5ed9532c36528806bdaec209 to your computer and use it in GitHub Desktop.
Script to install libimobiledevice on MacOS seamlessly
#!/bin/bash
# Script by dns
# Script to install libimobiledevice on MacOS seamlessly
# Install these first before running the script -> brew install automake usbmuxd make autoconf libtool pkg-config gcc openssl gnutls libgcrypt
# to fix fatal error: 'openssl/ssl.h' file not found errors run the below commands
# ln -s /usr/local/Cellar/openssl/1.0.2l/include/openssl /usr/local/lib/
# cp /usr/local/opt/openssl/include/openssl/* /usr/local/opt/openssl/include/
# brew link --force openssl
# ln -s /usr/local/Cellar/openssl/1.0.2l/include/openssl /usr/local/include/openssl
# to fix ideviceinstaller.c ssize_t errors make the below changes
# In the specified file ideviceinstaller.c, change while (zfsize < zs.size) { to —— while (zfsize < (unsigned) zs.size) {
# In the specified file ideviceinstaller.c, comment out fprintf(stderr, "Error: wrote only %d of %" PRIi64 "\n", total, amount);
set -e;
export LIBTOOLIZE='glibtoolize';
export openssl_CFLAGS='-I/usr/local/opt/' # changed it from openssl_CFLAGS=' ' to fix errors
export openssl_LIBS='-lssl -lcrypto'
#export LIBTOOL='libtool';
urllist=('https://github.com/libimobiledevice/libplist.git' \
'https://github.com/libimobiledevice/libusbmuxd.git' \
'https://github.com/libimobiledevice/libimobiledevice.git' \
'https://github.com/libimobiledevice/libirecovery.git' \
'https://github.com/libimobiledevice/idevicerestore.git' \
'https://github.com/libimobiledevice/ideviceinstaller.git');
flags=();
libstoinstall=("$@");
for theurl in "${urllist[@]}"; do git clone "$theurl"; done # Comment this if all the required folders already exist and you are running the script again
if [ "${#libstoinstall[@]}" == 0 ]; then
libstoinstall=('libplist' 'libusbmuxd' 'libimobiledevice' 'libirecovery' 'idevicerestore' 'ideviceinstaller');
fi;
cd "$(dirname "$0")";
for library in "${libstoinstall[@]}"; do
cd "$library";
NOCONFIGURE=1 ./autogen.sh;
cd ..;
rm -rf "$library-build";
mkdir "$library-build";
cd "$library-build";
if [ "$library" == 'libimobiledevice' ]; then
flags+=('--disable-openssl');
ldflags+=('-lgpg-error');
elif [ "$library" == 'ideviceinstaller' ]; then
cflags+=('-Wno-error=format' '-Wno-error=sign-compare' '--disable-openssl' );
fi;
"${PWD:0:${#PWD}-6}/configure" --prefix="$HOME/local/dist" --enable-static --disable-shared --disable-openssl "${flags[@]}" PKG_CONFIG_PATH="$HOME/local/dist/lib/pkgconfig";
make install;
cd ..;
done;
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment