Jump to content

Connecting to VPN With Alfred


Recommended Posts

So I created a command that works from in my terminal...

osascript -e  "set pid1 to do shell script \"wg-quick up mullvad-us2 > /dev/null 2>&1 &\" with administrator privileges"

Basically it asks me for Touch ID (to get administrator privileges) and then connects to my VPN. This works fine when I run it in bash.

When I put it into Alfred, it asks me for Touch ID and then doesn't work. Any ideas why?

Link to comment

Welcome @fyber,

 

Your shell (in the terminal) has context that Alfred doesn’t (namely a PATH with indicates where to look for binaries). Instead of wg-quick, give the full path (/usr/local/bin/wg-quick?).

 


 

In the future, when asking for help with a Workflow, please upload it somewhere so we can help you better. See the Reporting Problems with Workflows topic, as it gives a nice overview on how to build an effective report.

Link to comment
On 11/3/2018 at 2:08 PM, vitor said:

Welcome @fyber,

 

Your shell (in the terminal) has context that Alfred doesn’t (namely a PATH with indicates where to look for binaries). Instead of wg-quick, give the full path (/usr/local/bin/wg-quick?).

 

 


 

In the future, when asking for help with a Workflow, please upload it somewhere so we can help you better. See the Reporting Problems with Workflows topic, as it gives a nice overview on how to build an effective report.

 

Thanks for the response! Unfortunately this did not work. I also tried writing stdout to a file but that didn't work either (file was never created).

 

I've uploaded my workflow to Google Drive. WireGuard was installed through homebrew, and my Alfred is v3.7.

Link to comment
12 minutes ago, fyber said:

Is there a way I can run a newer version of bash?

 

Same way, give it the full path: /usr/local/bin/bash script_path. Or /usr/local/bin/bash -c "command_here". Or invoke the script as usual (./) but make sure the shebang is correct (#!/usr/local/bin/bash).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...