PIA Download via Curl

New Contributor III

So I use to have a script that downloaded PIA VPN but now when I run a curl command on terminal using ' curl https://www.privateinternetaccess.com/installer/x/download_installer_osx '
it just shows the website in plain text rather than an app can anyone offer any insights what is the best way to go about this?


Contributor III

Hello Euwan

The file address is https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip

You could try

curl --silent "https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip" -o /tmp/pia-macos.zip

Is this part of any automated process?

New Contributor III

Yea it is automated got it sorted now. Used this script


Make Temp Directory

mkdir -p /Volumes/Macintosh HD/Users/Shared/temp

Go to temp

cd /Volumes/Macintosh HD/Users/Shared/temp

download PIA text file with updated .zip name

curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx

isolate the zip URL and ZIP file name

PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "(http|https)://[a-zA-Z0-9./?=-]")

PIAZIP=$(ls | grep *.zip)

Download zip file

curl -LO $PIAURL

Unzip files

unzip $PIAZIP

sleep 30

Run PIA Installer

open /Volumes/Macintosh HD/Users/Shared/temp/Private Internet Access Installer.app

sleep 100

Remove Temp Directory

rm -rf /Volumes/Macintosh HD/Users/Shared/temp


New Contributor II

Three years later I find this solution. But somehow your GREP only returns 'https://i' Maybe something went wrong with the copy/paste in here?

GREP is not my specialty, so I am having a hard time trying to get it to work. If anyone has any tips?

New Contributor II

@Euwanh Thanks for the script. I have something similar I want to achieve but I want the site i'm going to to m.meraki.com requires that I input a value. I've used the POST command to add value but may be doing it wrong. Any suggestions?

New Contributor III

@tomatoes27 sorry for the very long delay did you need further assistance with this? I know how daunting it can be when you first start using jamf and then have to write scripts