Command line instal/configurationl of viscosity

Got a problem with Viscosity or need help? Ask here!

thegushi

Posts: 1
Joined: Fri Nov 25, 2022 7:55 pm

Post by thegushi » Fri Nov 25, 2022 8:03 pm
Hey all!

As part of my new-mac-setup (or after wiping my mac to hand it to the genius bar), I typically reinstall Viscosity (and most other things) via homebrew. While some mac-ish things aren't easily exposed via the defaults command, many things are. My questions:

1) Are there command line options I can use to cause a connection import from our OpenVPN appliance?

2) Is there a command-line way I can fill in my license key

3) Is there a way to manipulate other viscosity preferences (like the icon style) from the command line.

I can't find these answers in the knowledge base.

James

User avatar
Posts: 2312
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Sat Nov 26, 2022 6:51 am
Hi thegushi,

You can make use of macOS's "defaults" command to read and set preferences. For example, to read all of Viscosity's preferences you can enter the following into the Terminal:
Code: Select all
defaults read com.viscosityvpn.Viscosity
You can also read a setting individually, for example:
Code: Select all
defaults read com.viscosityvpn.Viscosity MenuBarIcons
To set/change a setting, you can use a command like so (in this example we're changing the menu icon):
Code: Select all
defaults write com.viscosityvpn.Viscosity MenuBarIcons "Solid Blue"
This can be used to set any setting, including your license information. However generally you want to extract the correct values to set from a working copy of Viscosity, as often these values can be encoded and not in plain text.

In regards to programatically using Viscosity's "Import from Server" feature, I'm afraid that's not possible. It must be done via Viscosity's GUI. If you have a configuration file already however, you could potentially copy it into the "~/Library/Application Support/Viscosity/OpenVPN" directory.

Cheers,
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs
2 posts Page 1 of 1