Skip to content

Instantly share code, notes, and snippets.

@leoxlin
Last active May 4, 2022 19:48
Show Gist options
  • Save leoxlin/5804136ec9a18df20b3be89cad2d0016 to your computer and use it in GitHub Desktop.
Save leoxlin/5804136ec9a18df20b3be89cad2d0016 to your computer and use it in GitHub Desktop.

Install 1Pass-CLI V1 and V2

1password CLI changed their schema significantly between v1 and v2.

This can cause a lot of scripts to break.

The official upgrade guide actually recommend running them in parallel.

https://developer.1password.com/docs/cli/upgrade

This gist conveniently

  1. Install v2 as op2
  2. Install v1 as op and op1
#!/bin/bash
V1_VERSION="v1.12.4"
V2_VERSION="v2.1.0"
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Must run as sudo"
exit
fi
curl -fsSL https://cache.agilebits.com/dist/1P/op/pkg/$V1_VERSION/op_apple_universal_$V1_VERSION.pkg -o /tmp/op_apple_universal_$V1_VERSION.pkg
curl -fsSL https://cache.agilebits.com/dist/1P/op2/pkg/$V2_VERSION/op_apple_universal_$V2_VERSION.pkg -o /tmp/op_apple_universal_$V2_VERSION.pkg
rm /usr/local/bin/op
rm /usr/local/bin/op1
rm /usr/local/bin/op2
sudo installer -pkg /tmp/op_apple_universal_$V2_VERSION.pkg -target /
mv /usr/local/bin/op /usr/local/bin/op2
sudo installer -pkg /tmp/op_apple_universal_$V1_VERSION.pkg -target /
cp /usr/local/bin/op /usr/local/bin/op1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment