Skip to content

Instantly share code, notes, and snippets.

@elcheco
Last active August 31, 2022 10:57
Show Gist options
  • Save elcheco/d7eebcaa8bb2b8afb6171a9ce24e923a to your computer and use it in GitHub Desktop.
Save elcheco/d7eebcaa8bb2b8afb6171a9ce24e923a to your computer and use it in GitHub Desktop.
Laravel Homestead - how to compile openssl on apple silicon m1 - arm64 - add this at the end of your after.sh file
#!/bin/bash
OPENSSL_VERSION=$(openssl version)
if [[ $OPENSSL_VERSION == *"OpenSSL 1.1.1m"* ]]; then
sudo DEBIAN_FRONTEND=noninteractive echo 'OpenSSL already compiled to the correct version' ;
else
cd /home/vagrant
mkdir build
mkdir build/openssl
wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz.sha256
tar -zxf openssl-1.1.1m.tar.gz --directory build/openssl
cd build/openssl/openssl-1.1.1m/
./config --prefix=/opt/openssl --openssldir=/opt/openssl/ssl
make
sudo make install
sudo mv /usr/bin/openssl /usr/bin/openssl.old
sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.old
sudo ln -s /opt/openssl/bin/openssl /usr/bin/openssl
sudo ln -s /opt/openssl/bin/c_rehash /usr/bin/c_rehash
sudo touch /etc/profile.d/openssl.sh
sudo chmod +x /etc/profile.d/openssl.sh
sudo tee -a /etc/profile.d/openssl.sh > /dev/null <<EOT
#!/bin/sh
export LD_LIBRARY_PATH=/opt/openssl/lib:${LD_LIBRARY_PATH}
EOT
echo "Updating configs"
echo "source /etc/profile.d/openssl.sh" | sudo tee -a /etc/bash.bashrc
echo "source /etc/profile.d/openssl.sh" | sudo tee -a /etc/zsh/zprofile
cd /home/vagrant
rm openssl-1.1.1m.tar.gz
rm openssl-1.1.1m.tar.gz.sha256
fi
@elcheco
Copy link
Author

elcheco commented Feb 11, 2022

Laravel Homestead - is a pre-build virtual machine using Linux Ubuntu 20.04 for ARM64 - the issue is that OpenSSL doesn't work inside this VM. - i's not code which works on macOS, but in VM running on macOS...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment